2013-11-21 112 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并转到部分响应查看循环事件,您会发现更方便的方法。