tsinghan
V2EX  ›  Swift

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

  •  
  •   tsinghan · Mar 26, 2015 · 5431 views
    This topic created in 4076 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   ·   2705 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 15:25 · PVG 23:25 · LAX 08:25 · JFK 11:25
    ♥ Do have faith in what you're doing.