0
我在應用程序中實現了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;}
如果我刪除我的應用程序代表所有這些代碼的酥料餅的工作完美......但如果我添加它,它不工作...我沒有想法是怎麼回事。 任何人都可以幫忙嗎?
可能是,您的故事板/ initViewController正在初始化爲'nil'。嘗試添加一個'NSLog(@「%@」,故事板);'和'NSLog(@「%@」,initViewController);'在各自的初始化行之後 –