PushViewController 不工作
我有一个应用程序,它有一个名为 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 isworking”记录,因此pushViewController行也被触发。
categoryView 是在我的 .h 文件中创建的:
CategoryView IBOutlet *categoryView;
}
@property (nonatomic, retain) IBOutlet CategoryView *categoryView;
在 store.xib 中,有一个 UIViewController,其出口链接到categoryView 出口。
在我的应用程序的其他地方,这是有效的,我似乎无法找出为什么这个不起作用
任何帮助将不胜感激! THNX
I have an application which has a view called store. In this view there is a button which loads the DetailView. Problem is that this detailview doesn't load/show. This is the code I use:
-(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");
}
The log "Button is working" logs, so the pushViewController line is also triggered.
categoryView is made in my .h file:
CategoryView IBOutlet *categoryView;
}
@property (nonatomic, retain) IBOutlet CategoryView *categoryView;
In the store.xib there is a UIViewController with an outlet linked to the categoryView outlet.
Somewhere else in my app this is working, and I can't seem to find out why this one isn't
Any help would be appreciated!
THNX
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否在 AppDelegate 中分配了 UINavigationController ?
@interface
@implementation didFinishLaunchingWithOptions
PushViewController 在整个应用程序中工作正常。
Did you assign the UINavigationController in your AppDelegate?
@interface
@implementation didFinishLaunchingWithOptions
pushViewController works fine then through the whole App.
听起来
会显示 navigationController 为零。
我建议创建一个导航类型的新项目,看看应该如何设置。
It sounds like
will show that navigationController is nil.
I suggest creating a new project of navigation type and see how this should be setup.
我已经找到了。由于我使用的是基于选项卡栏的应用程序,因此我需要将商店选项卡更改为导航控制器。当我改变它时,它起作用了!感谢大家的支持!!!
I have found it. Since I was using a tabbar based app, I needed to change the store tab to Navigation Controller. When I changed it, it worked! Thanks for all your support!!!
如果您的视图是基于笔尖的,您需要使用:
希望这会有所帮助。
If your view is nib based, you need to use:
Hope this helps.