【发布时间】:2014-05-02 11:43:56
【问题描述】:
我的应用程序从 UISplitViewController 开始,然后我想在我的故事板上显示来自 UIViewController 的另一个 UIView。所以我在 -viewWillAppear 中调用了这个函数:
-(void)showSplashScreen{
UIView *splashView;
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
UINavigationController *splashVC = [self.storyboard instantiateViewControllerWithIdentifier:@"splashscreen"];
splashView = splashVC.view;
NSLog(@"height: %f", splashVC.view.frame.size.height);
NSLog(@"width: %f", splashVC.view.frame.size.width);
NSLog(@"self view height: %f", self.view.frame.size.height);
NSLog(@"self view width: %f", self.view.frame.size.width);
[appDelegate.window addSubview:splashView];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC),dispatch_get_main_queue(), ^{
[UIView transitionWithView:appDelegate.window
duration:1.00f
options:UIViewAnimationOptionCurveEaseOut
animations:^(void){
splashView.alpha = 0.0f;
}
completion:^(BOOL finished){
[splashView removeFromSuperview];
}];
});
}
UIView 始终以纵向模式显示。我将情节提要中的所有内容都设置为横向模式。该应用程序以横向启动。只允许横向。当然没有这样的功能: [self.storyboard instantiateViewControllerWithIdentifier:@"splashscreen" inPortrait: False]; 我猜对开发人员来说会很容易......
那么,有人有想法吗? (当然我可以添加启动图像,或者我可以在 UISplitViewController 之前加载 UIViewController ......)但它也应该像这样工作吗?
【问题讨论】:
标签: objective-c uiview uiviewcontroller uisplitviewcontroller landscape