ios - 在横向模式下切换 View 时 Xcode 通用应用程序问题

标签 ios xcode view universal switching

我正在将 iPhone 应用程序更新为通用应用程序。 我有不同的带有 XIB 文件的 View Controller ,当在纵向模式下的 View 之间导航时,一切都运行良好,当实际 View 切换到横向时, View 调整大小完美。

但是当设备保持横向并导航到其他 View (xib)时,新 View 会像纵向模式一样打开显示,并且不会调整大小,并且 View 会超出屏幕,在右侧我可以看到最后一个 View 的一部分。我认为我没有使用正确的方法来调用新的 View Controller ,看起来像是在另一层之上创建了一个新层。

那么,当设备处于横向和纵向时,是否有一个通过自动调整大小来正确切换 View 的解决方案?

有关我的项目的更多信息:

在我的代表中:

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:[[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil]];
[navController setNavigationBarHidden:YES];
[window addSubview:navController.view];
[window makeKeyAndVisible];

调用 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"];
}

预先感谢您的回答。

最佳答案

我发现我的问题是方法错误,我使用了当前的 Modal 并且它有效:

-(IBAction)actioncontact:(id)sender{

Contactpage *listing = [[Contactpage alloc] initWithNibName:nil bundle:nil];
listing.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:listing animated:YES];
[listing release];

}

关于ios - 在横向模式下切换 View 时 Xcode 通用应用程序问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6313174/

相关文章:

ios - 提取MPMoviePlayerViewController音频以在后台继续收听

ios - 为什么在iOS中使用核心图形绘制的线的连接处会出现一个点?

ios - 在 App Store 中为现有的 Live App 购买

android - 创建平滑不确定的水平进度条

ios - iTunes 连接泛洪与 IAP 测试应用程序

ios - AVPlayer 播放 m3u8 流时如何捕获图像?

ios - 为什么不能删除本地xib?请看截图。

ios - 当我向 TestFlight 添加新的测试人员时,我是否必须为他们提供一个新的版本 "notified"?

mysql - 多个表的 View 使网站变慢

ruby-on-rails - 如何在 Rails 2.3 中的 .each 循环中排序