tsinghan
V2EX  ›  Swift

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

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

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