Created
September 10, 2014 08:48
-
-
Save maciekish/c2c903d9b7e7b583b4b2 to your computer and use it in GitHub Desktop.
Custom UINavigationBar height working in iOS 7 and 8. To use, find your navigation bar reference and just setHeight:200 etc.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I found out that there is a problem when you have your navigation controllers in storyboard. The main issue is that the width of your navigation bar is not stretched to whole width of screen. It looks like that method
newSize = [super sizeThatFits:size]; returns wrong width. I've added line of code that fixes this problem.
newSize.width = self.window.bounds.size.width; // just get the width from different source...
The whole size that fits method with small fix:
(CGSize)sizeThatFits:(CGSize)size
{
CGSize newSize;
if (self.height) {
newSize = CGSizeMake(self.superview.bounds.size.width, [self.height floatValue]);
} else {
newSize = [super sizeThatFits:size];
newSize.width = self.window.bounds.size.width;
}
return newSize;
}
Enjoy :)