【问题标题】:unable to view the line on swift无法快速查看线路
【发布时间】:2015-09-12 15:40:22
【问题描述】:

我正在尝试添加一条从屏幕左侧开始向右的水平线。但是这条线是不可见的。

let horizontalLine : CGRect = CGRectMake(45, height-50, 45, 55)
var testView : UIView = UIView(frame: horizontalLine)
self.view.addSubview(testView)

【问题讨论】:

    标签: swift xcode6 cgrectmake


    【解决方案1】:

    试试这个

    let horizontalLine : CGRect = CGRectMake(45, 100-50, 45, 55)
    //check value of height. this height>=(status bar height(20)+navigation bar height (44))
        var testView : UIView = UIView(frame: horizontalLine)
        testView.backgroundColor = UIColor.redColor()
        self.view.addSubview(testView)
    

    【讨论】: