views - PresentModalViewController 还是 addsubview?

标签 views flip addsubview presentmodalviewcontroller

嗨,我正在 xcode 3.2.3 中编写一个应用程序。我想要做的就是切换到另一个 View ,但我不确定这样做的最佳方法。我可以通过这两种方式中的任何一种...

PreferencesViewController *screen = [[PreferencesViewController alloc]initWithNibName:nil bundle:nil];

screen.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController:screen animated:YES];

[screen release];

或使用...
PreferencesViewController *screen = [[PreferencesViewController alloc]initWithNibName:nil bundle:nil];

[UIView beginAnimations:nil context:NULL];

[UIView setAnimationDuration:1.0];

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];

[self.view addSubview:screen.view]; 

[UIView commitAnimations];

我对这两种方法都有一些问题。如果我使用 presentModalViewController 并在 PreferencesViewController 中模拟内存警告,我的应用程序就会崩溃。第二种方法不是这种情况。然而,第二种方法使我的按钮在翻转动画期间看起来很奇怪。

有人可以告诉我什么是错的和/或告诉我哪种方法是正确的。

谢谢

最佳答案

您可以尝试这样做,不要忘记发布:

[self.navigationController pushViewController:[[YourViewController alloc]    initWithNibName:nil bundle:nil] animated:YES];   

关于views - PresentModalViewController 还是 addsubview?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3174858/

相关文章:

asp.net-mvc - 如何根据设备类型更改 ASP.NET MVC View ?

mysql - 将大量相同的 MySQL 表转换为一个和大量指向它的 View ?

asp.net-mvc - ASP.NET MVC2(ala RSpec)中的测试 View

html - 垂直翻转按钮背景图像

android - 如何在 Android 中移动 View ?

iPhone - 翻转 UIImage

R 在绘图上翻转 XY 轴

objective-c - "didRotateFromInterfaceOrientation:"未调用

iOS 11 - 在 VKSideMenu 中添加 subview 时崩溃

ios - UIImageview 添加到另一个 subview (即 UIScrollview)后不显示