V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
tsinghan
V2EX  ›  Swift

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

  •  
  •   tsinghan · 2015-03-26 14:29:14 +08:00 · 4344 次点击
    这是一个创建于 3317 天前的主题,其中的信息可能已经有所发展或是发生改变。
    3 条回复    2015-03-26 15:36:25 +08:00
    keithellis
        1
    keithellis  
       2015-03-26 14:56:29 +08:00
    NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationXXXX];
    [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
    keithellis
        2
    keithellis  
       2015-03-26 14:58:03 +08:00
    swift

    let value = UIInterfaceOrientation.XXX
    UIDevice.currentDevice().setValue(value, forKey: "orientation")
    tsinghan
        3
    tsinghan  
    OP
       2015-03-26 15:36:25 +08:00
    @keithellis 这个可以给单独某个viewcontroller设置?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5301 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 07:45 · PVG 15:45 · LAX 00:45 · JFK 03:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.