Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create a line with 0.5px width ONLY with storyboard?

Tags:

ios

storyboard

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?

like image 266
user2077625 Avatar asked Apr 13 '15 08:04

user2077625


3 Answers

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.

The constraint as seen in the document outline

like image 85
beseder Avatar answered Nov 01 '22 13:11

beseder


Just use user defined runtime attributes

user defined runtime attributes

Select your and Constraint and set to User Defined Runtime Attributes : constant Number 0,5

It's simple and safest!

like image 7
Daniel Smith Avatar answered Nov 01 '22 13:11

Daniel Smith


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.

like image 7
user1863617 Avatar answered Nov 01 '22 14:11

user1863617