2010-02-17 4 views
0

J'ai un projet dans lequel j'ai besoin de mettre deux UITableView sur un UIView.Est-il possible de mettre deux UITableview dans un UIView

Je sais qu'il a besoin de définir <UITableViewDelegate,UITableViewDataSource> et peut fonctionner ci-dessous:

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


- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView 


- (NSInteger)tableView:(UITableView *)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 

, mais je ne sais pas si ceux-ci peuvent traiter deux tableviews (différentes de 2 sections).

Répondre

1

Il semble que vous demandiez si un objet (peut-être un contrôleur de vue?) Peut avoir deux UITableView à la fois en tant que délégué. Oui, un contrôleur de vue peut être le délégué pour plusieurs vues de table. C'est la raison pour laquelle toutes ces méthodes passent dans un UITableView* comme premier argument; C'est à vous d'utiliser pour savoir lequel est lequel. Vous devriez garder quelques variables d'instance (IBOutlets probablement) dans votre contrôleur de vue afin que vous sachiez lequel est et que vous puissiez agir de manière appropriée.

Acclamations, Interdev.

Questions connexes