0

I am using a Storyboard and have added a UIView to my UIViewController. I would like this view to be a thin 0.5 height line, but for some reason, every time I type 0.5 in for height XCode will change that back to 1.

enter image description here

enter image description here

You can easily programmatically create a UIView with a 0.5 height, why can I not do this inside of a Storyboard?

Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
  • This is odd because, when I used to use IB and Storyboards, I was frequently irritated by the (seemingly) arbitrary assignment of *.5 values to constraints. Funny that Xcode will do them automatically but not allow you to do it manually. I know it's a hack from your desired answer, but what about creating an IBOutlet to the constraint and modifying its constant in code? Or, you can be like me and give up IB altogether! ;-) – mbm29414 Feb 04 '15 at 01:28
  • You can't make a _view_ that's half a point high, but you can certainly make a view that _draws_ a line half a point high. So just do that. – matt Feb 04 '15 at 01:48
  • @matt - Possible in IB? – Nic Hubbard Feb 04 '15 at 03:10
  • You'll have to write a very simple custom UIView subclass. But you can certainly add an instance of that UIView subclass in IB, sure. You want something like the MyHorizLine class that I describe in my book: http://www.apeth.com/iOSBook/ch10.html#_subclassing – matt Feb 04 '15 at 03:16
  • You can have a look at my answer on http://stackoverflow.com/questions/29006311/grouped-uitableview-remove-outer-separator-line/38620724#38620724 – Shad Jul 27 '16 at 19:25

0 Answers0