0

I have made a view like this:

enter image description here

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?

HemOdd
  • 697
  • 1
  • 7
  • 23
  • 4
    Possible duplicate of [How to create a line width of 0.5 pixels](https://stackoverflow.com/questions/21552115/how-to-create-a-line-width-of-0-5-pixels) – Cerise Apr 08 '19 at 13:11
  • @Cerise That question is different. I am not asking about the way to make the line 0.5. I am asking why some heights are not accepted by the storyboard and are changed to other numbers even when they are above 1. – HemOdd Apr 08 '19 at 13:21
  • I have set view hight to 0.8 on Xcode 10.0 and its working fine. Which Xcode you are using? – Abu Ul Hassan Apr 08 '19 at 13:22
  • @AbuUlHassan Thanks for the reply. I am using 10.1 – HemOdd Apr 08 '19 at 13:24
  • i have Xcode 10.0 otherwise we could have continued this discussion more sorry about that . – Abu Ul Hassan Apr 08 '19 at 13:26
  • a had a problem like you , but it deal with safeArea screen , I think it doesn't related to you , but you can just test it – mohsen Apr 08 '19 at 14:23

1 Answers1

0

Ok so it seems like the 0.67 is an xCode bug because the minimum jumps in height should be 0.5 meaning 0.5 is min, then 1.0 then 1.5 etc.

You can fix it by switching to iPad, setting the Height to 0.5 or 1.0 and then switching back to the desired iPhone.

EDIT

You can achieve smaller jumps then 0.5 programatically like this :

  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
    }
Vadim F.
  • 881
  • 9
  • 21
  • Thanks. I did it and now it jumps to 1 from 0.8 as you said. However, you said it is not possible to set the height to 0.8 but if you check @AbuUlHassan comment to my question, he is saying that he can enter 0.8 as the height in Xcode 10. How is that possible? – HemOdd Apr 08 '19 at 15:33