Nan Nan -4 years ago 75
iOS Question

Button position in FanMenu determining issue

I am trying to put fanMenu on the bottom of the UIView.
I set Auto layout property as this:
enter image description here

It works fine on iPhone7 simulator, but it doesn't work well on iPhone 5s and iPhone7 plus simulator. On iPhone 5s, it works like this:
enter image description here
As you can see, the button is not in the middle.

So, how to set the button's position in this view?Thanks a lot.

Answer Source

You want to use the add new constraints button in your storyboard. Xcode wants to make sure that you have both x and y coordinates set for Views(It also needs to know the height and width which are probably already defined)

When you open the Add New Constraints menu with your hamburger button selected you want to go to the top of the menu and select the bottom constraint. Set it to 0 and make sure the "Constrain to margins" button is checked.

Select Add 1 new constraint at the bottom then without updating the Frames select the Align menu just to the left of the Add new Constraints button and select the "Horizontally in Container" button(Its the second button from the bottom) and update frame with All Frames in Container. That should do it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download