[iphone] 在UITableViewController点击跳转界面

在storyboard里新建一个界面....
设置identifier属性:


然后在UITableViewController的didSelectRowAtIndexPath方法里添加如下代码:(先不考虑内存问题)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    TableInfoController *detail = [self.storyboard instantiateViewControllerWithIdentifier:@"tableInfoController"];
    detail.title = @"详细信息";
    //detail.state = [datasource objectAtIndex:indexPath.row];
    //detail.capital = [states objectForKey:detail.state];
    [self.navigationController pushViewController:detail animated:YES];
}


这样就可以在UITableViewController中点击一项的时候跳转到下一个界面

猜你喜欢

转载自iaiai.iteye.com/blog/1611301