xcode “AppDelegate”没有可见的@interface 声明了选择器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11122554/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No visible @interface for 'AppDelegate' declares the selector
提问by coolhongly
I'm now writing a registration screen before my tabBar shows up. My idea is to show my registration screen through this method (no dismiss function for now):
我现在正在写一个注册屏幕,然后我的 tabBar 出现。我的想法是通过这种方法显示我的注册屏幕(目前没有关闭功能):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
Register *registerView = [[Register alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:registerView animated:YES];
return YES;
}
Which is in AppDelegate.m
Unfortunately it doesn't work. Could you help me solve this please?
这是在 AppDelegate.m
不幸的是它不起作用。你能帮我解决这个问题吗?
回答by Ole Begemann
presentModalViewController:animated:
is a method of the UIViewController
class. Since the app delegate is not a view controller, you can't send it this method. To display your first view controller on screen, assign it to your app's main window's rootViewController
property:
presentModalViewController:animated:
是UIViewController
类的方法。由于应用程序委托不是视图控制器,因此您无法将此方法发送给它。要在屏幕上显示您的第一个视图控制器,请将其分配给您应用程序的主窗口的rootViewController
属性:
self.window.rootViewController = registerView;