iOS 自动,手动 屏幕翻转

屏幕翻转方案:

手动翻转:按钮触发:

- (IBAction)totate:(id)sender {

    

    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];

    self.view.transform = CGAffineTransformMakeRotation(M_PI/2);

    self.view.bounds = CGRectMake(0, 0, 480, 320);

    

}


- (BOOL)shouldAutorotate

{

    return NO;

}



- (NSUInteger) supportedInterfaceOrientations{

    return  UIInterfaceOrientationMaskLandscapeRight ;

}



自动翻转:


- (BOOL)shouldAutorotate

{

    return YES;

}



- (NSUInteger) supportedInterfaceOrientations{

    return  UIInterfaceOrientationMaskLandscapeRight ;

}




你可能感兴趣的:(ios,编程)