嗨全部 我正在实现一个使用TabBar和导航控制器的应用程序。在这个应用程序中,我需要更改特定视图的方向(我的应用程序中的照片库视图)(想要实现方向功能)。我在所有视图控制器的shouldautoroateorientation中设置了布尔值YES。通过这样做,所有的视图都是旋转的。我只想旋转一个特定的视图。任何人都有关于它的想法请回复。Iphone中的方向问题
在此先感谢.... :)
嗨全部 我正在实现一个使用TabBar和导航控制器的应用程序。在这个应用程序中,我需要更改特定视图的方向(我的应用程序中的照片库视图)(想要实现方向功能)。我在所有视图控制器的shouldautoroateorientation中设置了布尔值YES。通过这样做,所有的视图都是旋转的。我只想旋转一个特定的视图。任何人都有关于它的想法请回复。Iphone中的方向问题
在此先感谢.... :)
唯一的意见应该返回“YES”为shouldAutoRotateOrientation是那些真正想旋转。请注意,这意味着,有时导航和标签栏控制器将返回YES,有时它们应返回NO。
我还没有真正尝试过这一点,但设置它,看看会发生什么......
你评估在shouldAutorotateOrientation的方向是什么?如果你的目标手机,您的实现应该是这样的观点,即要允许对
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
旋转,这在所有其他视图
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
嗨朋友感谢您的宝贵建议......我在这里得到了解决方案 – 2010-11-19 04:17:38
请点击此链接并转到此文件的第42页... It Works For Me ... http://docs.huihoo .com/apple/iphone/iphone-application-programming/06-ViewControllers.pdf – 2010-11-19 04:18:21
请忽略以前的解决方案并点击此链接http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ViewControllerPGforiPhoneOS.pdf – 2010-11-19 04:20:38
我开始一个新的标签栏应用程序,然后创建一个“MyTabBarController”类(从UITabBarController派生),并将MainWindow.xib更改为使用MyTabBarController而不是UITabBarController。然后,我添加以下代码MyTabBarController:
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
BOOL result = interfaceOrientation == UIInterfaceOrientationPortrait;
if (self.selectedIndex == 0)
result = YES;
return result;
}
一旦我做到了,只有第一个视图控制器会转动,第二个不会。
但是,我注意到,只有当设备实际旋转时,才会调用此方法,一旦在横向上,在另一个选项卡上轻敲会将横向调整。所以也许你想做的事情不能完全做到。
我已经这样做了,但它没有工作... – 2010-11-16 07:06:10
它适合我。看到我的新答案。 – 2010-11-21 07:07:48