views:

48

answers:

2

I'm beginner in Iphone!
Can I place many UITableView (greater 1) in a View? And how to control them?

A: 

You can place as many UITableViews into a parent view, but it's probably not a good idea. Each delegate and datasource method for a tableView takes that tableView as its first argument, so it's easy to tell them apart.

Ben Gottlieb
A: 

Well its not a good idea to have multiple tableviews in a view but if you want it you can have them and control the by there names like

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if(tableView == declaredTableView1){
return 10;
}
else if(tableView == declaredTableView2){
return 11;
}
else {
return 12;
}   
}

Hope this helps.

Madhup
You mean by the names of the outlet variables that refer to the table views, right?
Peter Hosey
@peter yes I do this in this way
Madhup
@Madhup: thank so much!
hungbm06