IOS: tableview delegate methods for two tableview

前端 未结 4 866
暗喜
暗喜 2020-12-31 20:28

I have these delegate method for a tableview inside a class:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)ta         


        
4条回答
  •  無奈伤痛
    2020-12-31 21:23

    My suggestion is having your data source act as a table view delegate, instead of your controller.

    This is a design more closer to the Model-View-Controller pattern and will allow you much more flexibility and avoid checking for the specific value that the tableView argument has got in your delegate methods.

    In your case, your delegate/data source would be a class with a member of type NSArray and also implementing the UITableViewDelegate protocol.

提交回复
热议问题