Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Banner Height #66

Open
obrienalaribe opened this issue Oct 4, 2016 · 8 comments
Open

Setting Banner Height #66

obrienalaribe opened this issue Oct 4, 2016 · 8 comments

Comments

@obrienalaribe
Copy link

Is there a way to adjust the height of the banner so it doesn't go beyond the Nav Bar ?

@harlanhaskins
Copy link
Contributor

The banner sizes itself to the content, with regards to its subviews. You could try reducing the font size...

@alexjordaan
Copy link

How does one adjust the font size?

@harlanhaskins
Copy link
Contributor

You can set the font on either the titleLabel Or detailLabel property.

@alexjordaan
Copy link

banner.titleLabel.font.pointSize is a get only property?

@harlanhaskins
Copy link
Contributor

It's a regular UILabel. Create a UIFont with your desired font size.

@alexjordaan
Copy link

Ah, banner.titleLabel.font = UIFont.systemFontOfSize(12) is the correct way. Thanks!

@alexjordaan
Copy link

Is there any way to control the padding around the labels a bit? Specifically the top padding. I am only using one label item (currently Title) and would like to make the banner height a bit smaller so that it fits exactly on top of my navigation bar and doesn't extend past it.

@black-lotus
Copy link

black-lotus commented Nov 10, 2016

I am facing same issue :D
I just change to this following code

private func adjustHeightOffset() {
      guard let superview = superview else { return }
      if superview === Banner.topWindow() && self.position == .Top {
//        let statusBarSize = UIApplication.sharedApplication().statusBarFrame.size
//        let heightOffset = min(statusBarSize.height, statusBarSize.width) // Arbitrary, but looks nice.
//        contentTopOffsetConstraint.constant = heightOffset
//        minimumHeightConstraint.constant = statusBarSize.height > 0 ? 80 : 40

        contentTopOffsetConstraint.constant = 0
        minimumHeightConstraint.constant = 64
      } else {
        contentTopOffsetConstraint.constant = 0
        minimumHeightConstraint.constant = 0
      }
    }

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

No branches or pull requests

4 participants