2013-11-21 118 views
0

下面是我用來做ios5.How我實現它爲iOS6的代碼?它是不是適合我如何在iOS 6中實現旋轉?

- (BOOL)shouldAutorotateToInterfaceOrientation:  (UIInterfaceOrientation)interfaceOrientation 
{ 
    if (interfaceOrientation==UIInterfaceOrientationPortrait) 
    { 
     rotate=YES; 
     [self RotatingPotrait]; 

    } 
    if (interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown) 
    { 
     rotate=YES; 
     [self RotatingPotrait]; 

    } 
    if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) 
    { 
     rotate=NO; 
     [self rotatingLandscape]; 

    } 
    if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
    { 
     rotate=NO; 
     [self rotatingLandscape]; 

    } 
    return YES; 

} 

工作的任何幫助,爲什麼不使用-willRotateToInterfaceOrientation:duration:理解

回答

0

從你的例子,它看起來像你應該從

-shouldAutorotateToInterfaceOrientation:

BTW移動你的代碼

-willRotateToInterfaceOrientation:duration:

。我認爲,您最好先看看文檔 UIViewController Class Reference並轉到部分響應查看循環事件,您會發現更方便的方法。