这是我的storyboard截图,以确保我们理解清楚。
![enter image description here](https://istack.dev59.com/HOtn8.webp)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SkiCenter *myDetViewCont = [[SkiCenter alloc] initWithNibName:@"SkiCenter" bundle:[NSBundle mainBundle]];
myDetViewCont.ski_center = [centers objectAtIndex:indexPath.row];
UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
[[self navigationController] pushViewController:[storyBoard instantiateViewControllerWithIdentifier:@"SkiCenterIds"] animated:YES];
//[self.navigationController pushViewController:myDetViewCont animated:YES]; // "Pushing the controller on the screen"
[myDetViewCont release]; // releasing controller from the memory
myDetViewCont = nil;
}
Skicenter是我第一个选项卡的类名,SkiCenterIds是我的storyboard中选项卡控制器的标识符。
Skicenter.m中的代码是:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.navigationItem.title = ski_center;
}
但是我没有看到任何标题。那么我做错了什么吗?我也尝试过这个:
[self.navigationController setTitle:@"Live"];
或者self.title=ski_center;
ski_center的值有意义,因为它通常会在NSLog中打印出来。