【问题标题】:FPPopover not showingFPPopover 不显示
【发布时间】:2013-11-15 21:04:19
【问题描述】:

我正在我的应用程序中实现 FPPopover,它工作正常,直到我向应用程序委托添加一些代码以根据整个应用程序中的设备管理和显示正确的故事板。我添加的代码如下...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
UIStoryboard *storyboard = [self getStoryboard];
UIViewController *initViewController = [storyboard instantiateViewControllerWithIdentifier:@"Init"];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = initViewController;
[self.window makeKeyAndVisible];
sleep(3);

return YES;}

-(UIStoryboard*) getStoryboard {
UIStoryboard *storyBoard = nil;
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
    storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
}else{
    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone){
        // The iOS device = iPhone or iPod Touch
        CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
        if (iOSDeviceScreenSize.height == 480){
            // iPhone 3/4x
            storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

        }else if (iOSDeviceScreenSize.height == 568){
            // iPhone 5 etc
            storyBoard = [UIStoryboard storyboardWithName:@"Storyboard_iPhone_5" bundle:nil];
        }
    }
}

return storyBoard;}

如果我从我的 App 委托中删除所有这些代码,弹出框可以完美运行...但是如果我添加它,它就不起作用了...我不知道发生了什么。 有人可以帮忙吗?

【问题讨论】:

  • 可能,您的故事板/initViewController 正在初始化为nil。尝试在各自的初始化行之后添加NSLog(@"%@",storyboard);NSLog(@"%@",initViewController);

标签: ios iphone show popover fppopover


【解决方案1】:

您不需要此代码..进入项目的常规选项卡并在此处设置您的 iPhone 和 iPad 故事板:

在情节提要中,您可以选择初始视图控制器..

因此您可以删除所有故事板和初始视图控制器的代码

这是我在 appDelegate 中使用的代码 :) :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    return YES;
}

【讨论】:

    猜你喜欢
    • 2012-11-14
    • 1970-01-01
    • 2021-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多