FPPopover没有显示

时间:2013-11-15 21:04:20

标签: ios iphone show popover fppopover

我正在将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委托中删除所有这些代码,那么popover工作得很好......但如果我添加它就行不通......我不知道发生了什么。 有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

您不需要此代码..来自项目的常规标签,并在此处设置iPhone和iPad的故事板:

enter image description like here

在故事板中,您可以选择初始视图控制器..

因此,您可以删除故事板和初始viewController的所有代码

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

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