为什么我不能将新视图控制器推送到当前视图? [英] Why can't I push a new view controller onto the current view?
本文介绍了为什么我不能将新视图控制器推送到当前视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码并收到以下错误:
I am using the following code and getting the following errors:
编辑:参见这个如果您无法阅读上面的图片!
See this if you cannot read the image above!
ChangePasscode目前被宣布为一个类,是一个类使用.h和.m文件以及.nib文件查看控制器。
The "ChangePasscode" is currently declared as a class and is a view controller with .h and .m files along with a .nib file.
为什么会出现这些问题,我该怎么做才能修复它们?
Why are these issues happening, what can I do to fix them?
谢谢!
推荐答案
我要说你没有导入<您当前文件中的code> ChangePasscode.h 。
更新:以回应评论主题,如果要推送视图控制器,则需要实际创建导航结构。 iOS 5中的首选方式如下:
Update: In response to comment thread below, you'll need to actually create a nav structure if you want to push view controllers. The preferred way in iOS 5 is as follows:
// AppDelegate.h
// …Other existing code
@property (nonatomic, retain) UINavigationController *navController;
@end
// AppDelegate.m
@synthesize navController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
navController = [[UINavigationController alloc] initWithRootViewController:viewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = navController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
这篇关于为什么我不能将新视图控制器推送到当前视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文