我正在尝试添加从屏幕左侧开始向右的水平线。但这条线是不可见的。
let horizontalLine : CGRect = CGRectMake(45, height-50, 45, 55)
var testView : UIView = UIView(frame: horizontalLine)
self.view.addSubview(testView)
答案 0 :(得分:0)
试试这个
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)