objective-c - ios 其它的VC中都不横屏 只有一个VC横屏 该如何实现 百度了很多种方法 都不行
PHPz
PHPz 2017-04-17 17:34:58
0
2
263

是这样的 我只想专门做一个可以横屏播放视频的controller 有人知道怎么弄吗 我已经写好代码 只有横屏没实现了 如果可以 你可以运行一下我的代码 我把.h .m发给你,实现横屏 不要说把project里面的landspace 勾选 我只想用代码控制横屏 谢谢

PHPz
PHPz

学习是最好的投资!

reply all(2)
Ty80

This question is quite similar to https://segmentfault.com/q/1010000004486783/a-1020000004487227. I moved my answer here:

Add the shouldAutorotate method in ViewController. The logic inside is roughly as follows:

@implementation ViewController
- (BOOL)shouldAutorotate {
    int32_t i = 1;
    if (i == 1) {
        return NO;
    }
    return YES;
}
@end

If your ViewController is managed in UINavigationController, you need to modify the corresponding behavior of UINavigationController. For example, the implementation idea through Category is roughly as follows:

#import "UINavigationController.h"
@implementation UINavigationController (Overrides)
- (BOOL)shouldAutorotate {
    id currentViewController = self.topViewController;
    if ([currentViewController isKindOfClass:[<#your-vc#> class]]) {
        int32_t i = 1; 
        if (i == 1) {
            return NO;
        }
        return YES;
    }
    return YES;
}
@end
阿神

See if this helps you: http://www.tekuba.net/program/306/

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template