我有一个应用程序,它有一个名为store的视图。在此视图中有一个加载DetailView的按钮。问题是这个详细视图不能加载/显示。这是我使用的代码:
-(void)knop:(id)sender{
categoryView = [[CategoryView alloc] init];
//show detail view using buttonDetail...
[self.navigationController pushViewController:categoryView animated:YES];
[categoryView release];
NSLog(@"Button is working");
}日志"Button is working“记录了日志,因此pushViewController行也会被触发。
在我的.h文件中生成了categoryView:
CategoryView IBOutlet *categoryView;
}
@property (nonatomic, retain) IBOutlet CategoryView *categoryView;在store.xib中有一个UIViewController,其插座连接到categoryView插座。
在我的应用程序中的其他地方,这是有效的,而我似乎找不到为什么这个不是
任何帮助都将不胜感激!THNX
发布于 2011-07-07 04:27:26
我已经找到了。由于我使用的是基于选项卡栏的应用程序,因此我需要将store选项卡更改为Navigation Controller。当我改变它的时候,它起作用了!感谢您的支持!
发布于 2011-07-06 21:48:08
您是否在AppDelegate中分配了UINavigationController?
@接口
@property (nonatomic, retain) IBOutlet RootViewController *rootViewController;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;@实现didFinishLaunchingWithOptions
rootViewController = [[RootViewController alloc] initWithNibName:@"RootView" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[window addSubview:navigationController.view];
[self.window makeKeyAndVisible];pushViewController在整个应用程序中都运行得很好。
发布于 2011-07-06 20:30:42
听起来像是
NSLog(@"nav controller = %@", self.navigationController); 将显示navigationController为零。
我建议创建一个导航类型的新项目,看看应该如何设置。
https://stackoverflow.com/questions/6596059
复制相似问题