开发者

Is it possible to put two UITableview in a UIView

开发者 https://www.devze.com 2022-12-20 15:10 出处:网络
I have a project in which I need to put two UITableView on one UIView. I know it needs to set<UITableViewDelegate,UITableViewDataSource> and can function below:

I have a project in which I need to put two UITableView on one UIView.

I know it needs to set <UITableViewDelegate,UITableViewDataSource> and can function below:

-(NSString *) tableView:(UITableView *) tableView
titleForHeaderInsection:(NSInteger)section


- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView 


- (NSInteger)tableView:(UI开发者_运维百科TableView *)tableView 
 numberOfRowsInSection:(NSInteger)section


- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath 


-(NSIndexPath *)tableView:(UITableView *)tableView 
 willSelectRowAtIndexPath:(NSIndexPath *)indexPath


 - (void)tableView:(UITableView *)tableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath

but I do not know if these can process two tableviews (different from 2 sections).


It looks like you're asking if one object (maybe a view controller?) can have two UITableViews both using it as their delegate. Yes, a view controller can be the delegate for multiple table views-- that's why all of those methods pass in a UITableView* as their first argument; it's for you to use to figure out which one is which. You should keep a couple instance variables (IBOutlets probably) in your view controller so you know which is which and you can act appropriately.

Cheers, Interdev.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号