LeoNatan / LNPopupController

A framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
MIT License
3.04k stars 342 forks source link

layout of BarButtonItems issue #442

Closed law-cell closed 3 years ago

law-cell commented 3 years ago

when I set images of trailingBarButtonItems and leadingBarButtonItems this happened Simulator Screen Shot - iPhone 11 - 2021-04-22 at 22 05 19

when I set one of two buttonitems the position of the button looks good simulator_screenshot_57083D69-9FBB-40B1-BF25-A5C37F32A6B8

Steps to Reproduce

func setMiniPlayer(){ let storyboard = UIStoryboard(name: "Main", bundle: nil) let demoVC = storyboard.instantiateViewController(withIdentifier: "playerVC")

    self.popupNextButtonItem = UIBarButtonItem(image: UIImage(named: "next"), style: .plain, target: nil, action: nil)
    self.popupPlayButtonItem = UIBarButtonItem(image: UIImage(named: "play.fill"), style: .plain, target: nil, action: nil)

    self.musicImage = UIImage.init(named: "genre1")

    self.popupBar.barStyle = .prominent
    demoVC.popupItem.title = "Hello World"
    demoVC.popupItem.subtitle = "And a subtitle!"
    //demoVC.popupItem.progress = 0.34
    demoVC.popupItem.trailingBarButtonItems = [self.popupNextButtonItem!]
    demoVC.popupItem.leadingBarButtonItems = [self.popupPlayButtonItem!]
    demoVC.popupItem.image = musicImage

    self.presentPopupBar(withContentViewController: demoVC, animated: true, completion: nil)
}

Device, OS and Xcode Versions

ios 13 iPhone 11

LeoNatan commented 3 years ago

Hello,

If you run the example project, do you get the same behavior?

Thanks

LeoNatan commented 3 years ago

It looks like your button images might be too big. Are you using images from your catalog? Instead, try using UIImage(systemName: "...") instead.

law-cell commented 3 years ago

It looks like your button images might be too big. Are you using images from your catalog? Instead, try using UIImage(systemName: "...") instead.

Oh, that's my bad. As you said, my images are too big. Sorry. Thanks for your time.

law-cell commented 3 years ago

Simulator Screen Shot - iPhone 11 - 2021-04-22 at 22 16 45

It works now!
I am a novice. Sorry for wasting your time

LeoNatan commented 3 years ago

No problem. If you want to use custom images, you need to make sure they are the correct size for toolbars (25pt x 25pt).