V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
tsinghan
V2EX  ›  Swift

ios 能不能直接设置 viewcontroller 的 rotation 为横屏, 那边这样显示 view 就直接为横屏了?

  •  
  •   tsinghan · Mar 26, 2015 · 5378 views
    This topic created in 4052 days ago, the information mentioned may be changed or developed.
    3 replies    2015-03-26 15:36:25 +08:00
    keithellis
        1
    keithellis  
       Mar 26, 2015
    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationXXXX];
    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
    keithellis
        2
    keithellis  
       Mar 26, 2015
    swift

    let value = UIInterfaceOrientation.XXX
    UIDevice.currentDevice().setValue(value, forKey: "orientation")
    tsinghan
        3
    tsinghan  
    OP
       Mar 26, 2015
    @keithellis 这个可以给单独某个viewcontroller设置?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1307 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 17:23 · PVG 01:23 · LAX 10:23 · JFK 13:23
    ♥ Do have faith in what you're doing.