如何创建单元格转到下一页

时间:2013-04-15 12:10:51

标签: ios objective-c uitableview nsmutablearray

我创建了一个TableView页面,这个TableView有许多来自此代码的单元格:

@interface ViewController : UITableViewController
{
    NSMutableArray *animal;
    NSMutableArray *color;
    NSMutableArray *all;
}
@implementation ViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    animal = [[NSMutableArray alloc]initWithObjects:@"Lion",@"Tiger",@"Dog",@"Cat",@"Sheep",@"Wolf", nil];
    color = [[NSMutableArray alloc]initWithObjects:@"Blue",@"Red",@"Yellow",@"Green",@"Black", nil];

    all = [[NSMutableArray alloc]init];
    [all addObjectsFromArray:animal];
    [all addObjectsFromArray:color];
}

我想点击动物细胞阵列的时间转到下一页(下一页是
我想要点击动物单元格数组tableview页面刷新并显示信息点击单元格的其他单词的同名root tableview)

2 个答案:

答案 0 :(得分:0)

试试这个

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
 //if need any condition check here
 YourViewController *YVC = [[YourViewController alloc] initWithNibName:nil bundle:nil]]  
 [self.navigationController YourViewController:YVC animated:YES];

}

答案 1 :(得分:0)

请参考链接(它有从表中加载详细视图的示例), https://www.youtube.com/watch?v=0jt0vcrzq4A