在横向模式下切换视图时 Xcode 通用应用程序问题

发布于 2024-11-15 02:13:59 字数 1188 浏览 5 评论 0原文

我正在将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

合久必婚 2024-11-22 02:13:59

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

-(IBAction)actioncontact:(id)sender{

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

}

I found my problem the method was wrong, i used the present Modal and it works:

-(IBAction)actioncontact:(id)sender{

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

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文