2012-11-19 213 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只是做一個子類,並覆蓋第一種方法。