1.首先建立输出口,这是用IB实现界面必须首先做的.
@property (nonatomic, retain) IBOutlet UITableView *table0;
@property (nonatomic, retain) IBOutlet UITableView *table1;
@property (nonatomic, retain) IBOutlet UITableView *table2;
建立三个输出口,然后每个输出口对应一个tableview.
2.这样每个输出口对应一个tableview.
在处理数据的时候可以这样处理他们
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
if(table0 == tableView){
return [self.computers count];
}
else if(table1 == tableView){
return [self.computers1 count];
}
else{
return [self.computers count];
}
}
3.这样就可以实现一个界面3个tableview了,有的网友说弄多个delegate,完全没必要阿..现在上图,看看效果.
本文介绍如何在iOS应用中使用Interface Builder(IB)实现一个界面包含三个TableView的布局,并通过Objective-C代码设置TableView的数据源及代理,实现不同TableView的数据显示。
6401

被折叠的 条评论
为什么被折叠?



