• 强制iphone界面马上旋转


    在现在的ios sdk中,我们一般通过UIApplication的setStatusBarOrientation:来进行View的强制旋转(当然,还要配合- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation),但是,setStatusBarOrientation并不一定马上会执行shouldAutorotateToInterfaceOrientation进行界面旋转,这时,有个小技巧可以让界面马上旋转过来,那就是调用一下 UINavigationController的presentModalViewController:animated:

    .........{
        
    //为了马上旋转过来
        UINavigationController* nav = [[GurgleAppDelegate getAppDelegate] navigationController];
        UIViewController 
    *controller = [[UIViewController alloc] init];
        UINavigationController 
    *parentController = [[UINavigationController alloc] initWithRootViewController:controller];
        [nav presentModalViewController:parentController animated:NO];
        [controller dismissModalViewControllerAnimated:NO];
        [parentController release];
        [controller release];

    }

     
    // Override to allow orientations other than the default portrait orientation.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        
    // Return YES for supported orientations.
        return viewOrientation == interfaceOrientation;

    }
     
  • 相关阅读:
    POJ 3186 Treats for the Cows
    HDU 1226 超级密码| NYOJ 929 密码宝盒
    POJ 1661 Help Jimmy
    POJ 1458 Common Subsequence
    POJ 1015 Jury Compromise
    window.history,页面中的返回按钮
    网站新功能引导镂空效果
    HTML5存储
    JSON对象
    点击超链接,将页面中某个数据传到另一个页面
  • 原文地址:https://www.cnblogs.com/think/p/ForceViewRotateImmediatly.html
Copyright © 2020-2023  润新知