1
的工作,我有很多意見。所以我分類我的tabbar控制器像這樣。取向不會在iOS 5中工作,這是在我的TabBar控制器應用的ios 6
-(BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
return (UIInterfaceOrientationMaskAll);
}
,並在我的視圖控制器也
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskLandscapeLeft|UIInterfaceOrientationMaskLandscapeRight);
//OR return (UIInterfaceOrientationMaskAll);
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
//return (interfaceOrientation == UIInterfaceOrientationPortrait);
return (UIInterfaceOrientationMaskAll);
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
}
else
{
}
}
我的問題是方向是工作在IOS 6和IOS不工作5 謝謝。
感謝答覆是工作可以üPLZ澄清我它是如何工作和方法被稱爲第一,我完全糊塗了 – siva
我還有一個問題,假設我有我的TabBar兩種觀點,如果我在第二個點擊和旋轉,回來第一個我所有的按鈕和標貼中受到干擾,是視圖將出現方法調用,當我旋轉從portriat到風景viceversa。 – siva
是viewWillAppear中被調用 – Baddu