我有行的表格視圖...選擇一個項目後我想用新的數據源顯示tableView。更改選定行後的tableView的數據源
我試圖執行:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.searchDisplayController setActive:YES animated:YES];
Game *game = [self.filteredListContent objectAtIndex:indexPath.row];
//name your class names with capitals
NSMutableArray *arrayToBeAdded= [[NSMutableArray alloc]initWithArray:newgamearray];
[ListContent removeAllObjects];
[ListContent addObject:arrayToBeAdded];
,但我得到exeption在init的
[ListContent removeAllObjects];
實現:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellID = @"cellSgames";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
Gmage *game = [self.ListContent objectAtIndex:indexPath.row];
在.h文件我宣佈:
NSArray AllList;
NSMutableArray ListContent;
有什麼想法?
爲什麼你想顯示一個新的數據源tableView? – freelancer 2012-08-16 07:38:10
選擇一個項目後,我想展示他的孩子項目 – vadim 2012-08-16 07:46:14
@vadim你會得到哪些例外? ListContent在哪裏聲明?它是什麼? – 2012-08-16 07:55:28