Xcode IB: UIButton hidden but have still buttons space

后端 未结 6 1789
悲哀的现实
悲哀的现实 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:43

    A better approach for above scenario - You dont need to set any autolayout or frames :)

    Use UITableView and create custom cell with UIButtons in it.

    1. Set UITableViewCellSelectionStyle to None

    2. Here your button background is same for all cell

    3. Create an array with above button titles

    4. When ever you want to hide buttons just remove it from array.

提交回复
热议问题