Xcode IB: UIButton hidden but have still buttons space

后端 未结 6 1752
悲哀的现实
悲哀的现实 2021-02-15 18:22

I have the following issue in my iPhone app. I have 4 buttons in my IB also linked to my UIViewController (IBOutlet) When I for example hide the second

6条回答
  •  野的像风
    2021-02-15 18:38

    maybe there is a solution with autoLayout in IB but I'm not sure about that. Programmatically you can add all your button to an array in order. and whenever you hide a button or not you loop trough the array of button and each time you find one that is not hidden you set the y coordinate on the frame to a a value and you increment this value by what you need so the next not hidden will be placed according to the last position used.

提交回复
热议问题