我正在开发一个应用程序,它有一个主菜单,然后根据使用 UINavigationController 单击的菜单项切换视图。每当我运行我的应用程序并单击菜单中的某个项目时,在视图加载前五秒钟。这是正常的还是我需要以其他方式执行此操作。感谢您的关注!
我在 RootViewController.m 中的代码如下所示。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *selectedMenuOption = [menuOptions objectAtIndex:indexPath.row];
if (selectedMenuOption == @"Trails") {
TrailsViewController *trailsViewController = [[TrailsViewController alloc] initWithNibName:@"TrailsViewController" bundle:[NSBundle mainBundle]];
trailsViewController.selectedMenuOption = selectedMenuOption;
[self.navigationController pushViewController:trailsViewController animated:YES];
[trailsViewController release];
}
if (selectedMenuOption == @"Bike Shops") {
ShopsViewController *shopsViewController = [[ShopsViewController alloc] initWithNibName:@"ShopsViewController" bundle:[NSBundle mainBundle]];
shopsViewController.selectedMenuOption = selectedMenuOption;
[self.navigationController pushViewController:shopsViewController animated:YES];
[shopsViewController release];
}}