2012-11-19 219 views
0

我将我的应用程序转换为ios6,但我得到旋转问题。 有人能帮我这方法会被调用,当我们转动装置ios6旋转问题

回答

0
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 
    [self doLayoutForOrientation:toInterfaceOrientation]; 
} 


- (void)doLayoutForOrientation:(UIInterfaceOrientation)orientation { 
if (UIInterfaceOrientationIsPortrait(orientation)) 
{ 
//set the frames here 
} 
else 
{ 
//set the frames here 
} 
} 

这些是ios 6中的新方法,您可以根据方向设置帧。希望它对你有用。

0

- (BOOL) shouldAutorotate -(NSUInteger)supportedInterfaceOrientations

这些都是加入到iOS 6

+0

我已经使用这个,但它不是每次都调用 –

+0

你是否在使用任何第三方UI框架如three20或其他? –

+0

不,我只使用sdwebimage –

0
-(NSUInteger)supportedInterfaceOrientations 

{ 
    return UIInterfaceOrientationMaskAll; 
} 

-(void)viewWillLayoutSubviews 
{ 
if([self interfaceOrientation] == UIInterfaceOrientationPortrait||[self interfaceOrientation] ==UIInterfaceOrientationPortraitUpsideDown) 
    { 
    //set the frames here 
    } 
    else if ([self interfaceOrientation] == UIInterfaceOrientationLandscapeLeft||[self interfaceOrientation] == UIInterfaceOrientationLandscapeRight) 
    { 
     //set the frames here 
    } 
} 

更好的去使用此,上述新功能方法将在您每次更改设备的方向时调用。

+0

嘿谢谢你,它的作品Gud @krish – Babul

0

手柄旋转这些方法

-(BOOL) shouldAutorotate 
{ 
    return NO; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

如果某些视图中旋转,你不想等的UIImagePickerController只是做一个子类,并覆盖第一种方法。