特定頁面實現旋轉效果

1.在AppDelegate.h 裏添加標記spa

2.在AppDelegate.m 裏添加這個方法3d

3.打開屏幕旋轉server

[(AppDelegate*)[UIApplication sharedApplication].delegate setAllowRotation:YES];blog

 

4.取消屏幕旋轉rem

    [(AppDelegate*)[UIApplication sharedApplication].delegate setAllowRotation:NO];get

    [[NSNotificationCenter defaultCenterremoveObserver:self];it

    if ([[UIDevice currentDevicerespondsToSelector:@selector(setOrientation:)]) {io

        SEL selector = NSSelectorFromString(@"setOrientation:");class

        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDeviceinstanceMethodSignatureForSelector:selector]];select

        [invocation setSelector:selector];

        [invocation setTarget:[UIDevice currentDevice]];

        int val = UIInterfaceOrientationPortrait;

        [invocation setArgument:&val atIndex:2];

        [invocation invoke];

    }

相關文章
相關標籤/搜索