开发者

IPhone SDK_A table view inside of a table view

I want to make a table view inside of a table view. I mean how can I make an app that clicking 开发者_如何学JAVAa cell goes to another list of cells to click to go subclass?


Convolution's answer contains a memory leak. Proper code should look like this:

MySecondViewController *secondController = [[MySecondViewController alloc]
    initWithNibName: @"SecondViewController" bundle: nil];
if (secondController != nil) {
    [self.navigationController pushViewController: secondController animated: YES];
    [secondController release];
}

The release is essential. Otherwise you leak memory.


I don't know what you mean by a table view inside of a table view, I think what you want to do is have a hierarchy of table views. You can push another table view onto the stack within the delegate method didSelectRowAtIndexPath.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    MySecondViewController *secondController = [[MySecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    [self.navigationController pushViewController:secondController animated:YES];
}

By implementing this method when you click a cell, it goes to another table view (list of cells).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜