【问题标题】:No visible @interface for 'AppDelegate' declares the selector'AppDelegate' 没有可见的@interface 声明选择器
【发布时间】:2012-06-20 15:09:26
【问题描述】:


在我的 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;
}

在 AppDelegate.m 中
不幸的是,它不起作用。你能帮我解决这个问题吗?

【问题讨论】:

    标签: iphone objective-c ios xcode delegates


    【解决方案1】:

    presentModalViewController:animated:UIViewController 类的一个方法。由于应用程序委托不是视图控制器,因此您不能向它发送此方法。要在屏幕上显示您的第一个视图控制器,请将其分配给应用主窗口的 rootViewController 属性:

    self.window.rootViewController = registerView;
    

    【讨论】:

    • 很抱歉我不能让它工作。可以求完整代码吗?
    • 这是完整的代码。显然,我不知道包含主窗口的变量/属性的名称。只需查看 Apple 的任何项目模板。它们都包括这一行。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-27
    相关资源
    最近更新 更多