I have made a view like this:
To make the divider lines, I am using UIViews with small heights.
Now , the problem is that the storyboard doesn't accept some heights for my dividers. For instance, when I try to set the height to 0.8, it changes it to 0.67. or when I try to set it to 1.5, it changes it to 1.67 and so on.
I have tried to set height constraints and also removing all of the constraints from the whole container but nothing changed.
Does anyone know what is the reason for this?
答案 0 :(得分:0)
好吧,看来0.67是一个xCode错误,因为高度的最小跳跃应该为0.5,这意味着最小为0.5,然后是1.0,然后是1.5,依此类推。
您可以通过以下方法修复它:切换到iPad,将“高度”设置为0.5或1.0,然后再切换回所需的iPhone。
编辑
您可以像这样通过编程方式实现较小的跳跃,然后达到0.5:
let height = CGFloat(0.8)
@IBOutlet weak var viewOutlet: UIView!
override func viewDidLoad() {
super.viewDidLoad()
viewOutlet.frame.size.height = height
print(viewOutlet.frame.height) //prints 0.8
}