【问题标题】:UIView confusionUIView 混乱
【发布时间】:2015-01-13 13:50:24
【问题描述】:

所有,我试图找出一个 UIView 用这段代码变得更大:

 ColouredSquare.backgroundColor = UIColor(red: 0.84, green: 0.90, blue: 0.95, alpha: 1.0)
    ColouredSquare.frame = CGRect(x: 0, y:50, width: 400, height: 30)
    self.view.addSubview(ColouredSquare)
    UIView.animateWithDuration(1.0, animations: {
        self.ColouredSquare.frame = CGRect(x: 0, y: 50, width: 400, height: 180)
    })

我在视图中添加了一个按钮。 但是按钮在 UIView 之前绘制。

【问题讨论】:

  • ColouredSquare 实例会更大,但无法告诉您该视图在视图层次结构的这个小片段中的位置。也许您需要检查视图和代码之间的插座连接...

标签: ios swift uiview


【解决方案1】:

我在这里遗漏了什么明显的东西吗?

你设置了框架:

ColouredSquare.frame = CGRect(x: 0, y:50, width: 400, height: 30)

然后animate就是,将高度增加到180:

self.ColouredSquare.frame = CGRect(x: 0, y: 50, width: 400, height: 180)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-26
    • 1970-01-01
    • 2012-02-06
    • 2010-12-04
    • 2011-05-05
    • 2018-05-30
    • 2014-07-29
    • 1970-01-01
    相关资源
    最近更新 更多