mmoaay
V2EX  ›  问与答

autolayout 距离两侧距离为-16

  •  
  •   mmoaay · Feb 3, 2015 · 4449 views
    This topic created in 4126 days ago, the information mentioned may be changed or developed.
    最近使用autolayout做开发,发现如果设置一个view填充整个viewcontroller,距离两侧的距离竟然是-16,然后在iOS7这个view就超出屏幕了,不能理解是什么原因,有大神来解释下么?
    6 replies    2015-02-04 01:09:14 +08:00
    mmoaay
        1
    mmoaay  
    OP
       Feb 3, 2015
    刚才研究了下,用equalwidth设置宽度和superview一致,然后垂直居中就可以了
    11
        2
    11  
       Feb 3, 2015
    把那个 relative to margin 去掉试试
    Mr2
        3
    Mr2  
       Feb 3, 2015
    同 2L 的意见 这个 iOS8的新东西容易让新接触的优势用 storyboard 的人疑惑
    kobe1941
        4
    kobe1941  
       Feb 3, 2015
    @Mr2 autolayout在iOS6就有了
    Mr2
        5
    Mr2  
       Feb 3, 2015
    @kobe1941 你当真你知道我在说什么?

    `NSLayoutAttributeLeftMargin` `layoutMargins `
    mmoaay
        6
    mmoaay  
    OP
       Feb 4, 2015 via iPhone
    嗯嗯,后来试了下,去掉constraints to margins那个勾选框之后再设置就完美解决了,谢谢各位啦
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3029 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 08:37 · PVG 16:37 · LAX 01:37 · JFK 04:37
    ♥ Do have faith in what you're doing.