My client can\'t read iPhone\'s default fonts, the size is too small. I have an application with a navigation bar and I need to make everything in it bigger, for example, th
By subclassing you can achieve that and still support iOS 3+:
#import
@interface ASNavigationBar : UINavigationBar
@property (nonatomic , retain) UIImage *backgroundImage;
@end
And implementation:
#import "ASNavigationBar.h"
@implementation ASNavigationBar
@synthesize backgroundImage = _backgroundImage;
-(void) setBackgroundImage:(UIImage *)backgroundImage
{
if (_backgroundImage != backgroundImage)
{
[_backgroundImage release];
_backgroundImage = [backgroundImage retain];
[self setNeedsDisplay];
}
}
-(void) drawRect:(CGRect)rect
{
// This is how the custom BG image is actually drawn
[self.backgroundImage drawInRect:rect];
}
- (CGSize)sizeThatFits:(CGSize)size
{
// This is how you set the custom size of your UINavigationBar
CGRect frame = [UIScreen mainScreen].applicationFrame;
CGSize newSize = CGSizeMake(frame.size.width , self.backgroundImage.size.height);
return newSize;
}
@end