如何在一个UIView中显示一个UITableView-CSDN论坛

2025-05-05 17:06:20
推荐回答(1个)
回答1:

在UIView中添加表格
1、直接在Interface Builder中拖一个来就好了,然后绑定委托,数据
2、代码创建:

self.view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease];

UITableView * table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 100, 200) style:UITableViewStylePlain];

//可编辑

table.allowsSelectionDuringEditing = YES;

[self.view addSubview:table];