I am new to iOS storyboard, can anyone tell me how to create a line with 0.5 px width? I have read this post:How to create a line width of 0.5 pixels and I know how to make it by coding, but does it have a easier way such as using storyboard?
It is working with xib/Storyboard directly.
To make it work: Do NOT hit the return key after entering 0.5 in the Size inspector. Just click somewhere on the storyboard. Then 0.5 will stay as value. It seems that IB checks that value and corrects it only if you hit enter.
The size inspector will still show "0" as value, when you view the constraint again. But in the document outline you can see the "0.5". And it also renders it as 0.5 at runtime.
Just use user defined runtime attributes
Select your and Constraint and set to User Defined Runtime Attributes : constant Number 0,5
It's simple and safest!
It can be done in Storyboard itself - just select the desired constraint and go to the "Identity Inspector", now add a new Key Path with name "constant" and set its type to "Number" with a value of 0.5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With