特定页面实现旋转效果

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];

    }

相关文章
相关标签/搜索