UserDefine运行时属性在Xcode8.0中不起作用

时间:2016-11-09 12:02:49

标签: ios swift xcode xcode8

从storyboard设置时,似乎xcode8.0没有设置用户运行时属性的值。我们要做的很简单,将单元格内的标签设置为corneRadius为10,宽度/高度为20。我尝试调试视图,我得到以下输出,其具有奇怪的宽度高度(1000/1000 ..?)

  

_UILabelLayer:0x600000283750; position = CGPoint(500 500); bounds = CGRect(0 0; 1000 1000); delegate =&gt ;; opaque = YES; allowsGroupOpacity = YES; cornerRadius = 10 ; contentsMultiplyColor =(null); rasterizationScale = 2; contentsScale = 2>

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:1)

我认为这对你有帮助。

enter image description here

并查看clipToBounds

enter image description here

检查"剪辑子视图"等于代码addMessageLabel.clipsToBounds = YES;

答案 1 :(得分:0)

您可以在控制器上使用此代码和方法

 override func viewDidLayoutSubviews() {
            super.viewDidLayoutSubviews()
            yourLabel.clipsToBounds = true
            yourLabel.layoutIfNeeded()
            print("Frame ------> ",yourLabel.frame)
     }