在横向模式下切换视图时 Xcode 通用应用程序问题
我正在将 iPhone 应用程序更新为通用应用程序。 我有不同的带有 XIB 文件的视图控制器,当在纵向模式下的视图之间导航时,一切都运行良好,当实际视图切换到横向时,视图大小调整完美。
但是,当设备保持横向并导航到其他视图(xib)时,新视图会像纵向模式一样打开显示,并且不会调整大小,并且视图会超出屏幕,在右侧我可以看到一部分最后一个视图。我认为我没有使用正确的方法来调用新的视图控制器,看起来像是在另一层之上创建了一个新层。
那么,当设备处于横向和纵向时,是否有一个通过自动调整大小来正确切换视图的解决方案?
有关我的项目的更多信息:
在我的委托中:
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:[[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil]];
[navController setNavigationBarHidden:YES];
[window addSubview:navController.view];
[window makeKeyAndVisible];
调用视图的方法:
-(IBAction)actioncontact:(id)sender{
Contactpage *listing = [[Contactpage alloc] initWithNibName:@"Contactpage" bundle:nil];
self.contpage = listing;
[listing release];
[self.view addSubview:contpage.view];
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionFade];
[animation setSubtype:kCATransitionFromRight];
[animation setDuration:0.25];
[[self.view layer] addAnimation:animation forKey:@"transitionViewAnimation"];
}
提前感谢您的回答。
I am updating an iPhone app to an universal.
I have different views controller with XIB files, all is working well when navigate between this views on portrait mode, when the actual view is switching to landscape the view resize perfectly.
But when the device stay on landscape and navigate to others views (xib), the new view open show like in portrait mode and didn't resize and the view go out of the screen, and on the right part i can see a part of the last view. I think i am not using the right method to call a new view controller, looks like is created a new layer one over other.
So, is it a solution to switch views properly with auto resizing when the device is on landscape and portrait ?
More information about my project :
in my delegate :
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:[[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil]];
[navController setNavigationBarHidden:YES];
[window addSubview:navController.view];
[window makeKeyAndVisible];
the method to call a view :
-(IBAction)actioncontact:(id)sender{
Contactpage *listing = [[Contactpage alloc] initWithNibName:@"Contactpage" bundle:nil];
self.contpage = listing;
[listing release];
[self.view addSubview:contpage.view];
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionFade];
[animation setSubtype:kCATransitionFromRight];
[animation setDuration:0.25];
[[self.view layer] addAnimation:animation forKey:@"transitionViewAnimation"];
}
Thank in advance for your answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现我的问题是方法错误,我使用了当前的 Modal 并且它有效:
I found my problem the method was wrong, i used the present Modal and it works: