2的UITableView在同一UIView的问题
问题描述:
我有2个UITableView的设置和信息搜索结果如下2的UITableView在同一UIView的问题
IBOutlet UITableView* Settings ;
IBOutlet UITableView* SearchResult;
@property (nonatomic , retain) IBOutlet UITableView* Settings ;
@property (nonatomic , retain) IBOutlet UITableView* SearchResult;
在tableview中委托和源I由表名
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
if (tableView == Settings) {
return 2;
} else {
return 0 ;
}
}
搜索它们之间diffrentiate第二张桌子永远不会触发事件,我的意思是设置表格工作得很好,但第二个从未触发事件,即使我设置了其数据源,并删除文件所有者
也[self.SearchResult reloadData];
永远不会触发 任何建议,以解决
问候
答
不宜段在第二台数为1,而不是0的事件? 第二个表是不可见的,如果段数为0 ..
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
if(tableView == Settings)
{
return 2;
}
return 1; // Called for second table
}
答
你有没有手动设置这两个表的委托和数据源???如果没有设置它...这可能有助于
答
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSInteger *returnValue = 0;
if ([tableView isEqual:Settings]{
NSLog (@"Settings did called datasource methods");
returnValue = 2; // number of sections in your table - if you have NSArray datasource use [datasource count] ;
} else if ([tableView isEqual:SearchResult"){
NSLog (@"SearchTable did called datasource methods);
returnValue = 1; // or count of that datasource
}
return returnValue;
}
这可能有助于调试
时,将其更改为1它给exec_bad_ccess – AMH 2011-06-07 10:28:02
我猜的错误是别的地方在你的cellForRow。尝试删除第二个返回,看看你是否得到第二个表。 – visakh7 2011-06-07 10:59:08