Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Side Menu button is incorrect dimensions. #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Side Menu button is incorrect dimensions. #135

wants to merge 1 commit into from

Conversation

aaronwardle
Copy link

Building the project against iOS11 we have spotted that the UIBarButton is not in the correct location on the left navigation bar looking at the apple documentation it recommends that the standard non retina size of the button should be 22px x 22px.

Building the project against iOS11 we have spotted that the UIBarButton is not in the correct location on the left navigation bar looking at the apple documentation it recommends that the standard non retina size of the button should be 22px x 22px.
@aaronwardle aaronwardle changed the title Update UIKitExtensions.swift Side Menu button is incorrect dimensions. Nov 24, 2017
@StevenVerheyen
Copy link

@aaronwardle, perhaps we can extend this PR with some checks? For iOS 10 and lower, it should keep the old size and from iOS 11 and further it should have the new one. Tested this morning and for iOS 10 it has been moved a bit too much to the left with these changes. For iOS 11 it seems fine with your changes. I will add screenshots at noon (Belgium time) to give some view examples :)

@aaronwardle
Copy link
Author

Cheers Steven I will take a look at this, thanks for the help btw

@StevenVerheyen
Copy link

StevenVerheyen commented Nov 25, 2017

Okay a bit later than promised. But here you can see the difference between iOS 10 and iOS 11 and it is also noticeable that for iOS 10 the size should remain the same. Not for the size itself, but the padding to the left of it :)

https://imgur.com/a/xrkQf

With this piece of code it seems to be lay-outed correctly:

var sizeHamburger = 40
if #available(iOS 11.0, *) {
    sizeHamburger = 22
}

let button = UIButton(frame: CGRect(x: 0, y: 0, width: sizeHamburger, height: sizeHamburger))

https://imgur.com/a/oNubA

@diolce
Copy link

diolce commented Dec 15, 2017

I have made the changes in let button = UIButton (frame: CGRect (x: 0, y: 0, width: 22, height: 22)) and the view does not change, it is also located in the center. This is my result before and after the modification
captura de pantalla 2017-12-15 a las 14 08 33

@StevenVerheyen
Copy link

@diolce, are you sure it is not related to something else? I tried this code and also with my suggested code for iOS 10 and everything is fine on my side.

@diolce
Copy link

diolce commented Dec 15, 2017

this is my declaration of the menu in didFinishLaunchingWithOptions in AppDelegate
SideMenuController.preferences.drawing.menuButtonImage = UIImage(named: "menu")
SideMenuController.preferences.drawing.sidePanelPosition = .overCenterPanelLeft
SideMenuController.preferences.drawing.sidePanelWidth = 332
SideMenuController.preferences.drawing.centerPanelShadow = true
SideMenuController.preferences.animating.statusBarBehaviour = .horizontalPan
SideMenuController.preferences.animating.transitionAnimator = FadeAnimator.self`

@diolce
Copy link

diolce commented Dec 16, 2017

What worked for me was to add this to the button
if #available(iOS 9.0, *) { button.widthAnchor.constraint(equalToConstant: 43.0).isActive = true } else { // Fallback on earlier versions } if #available(iOS 9.0, *) { button.heightAnchor.constraint(equalToConstant: 43.0).isActive = true } else { // Fallback on earlier versions }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants