Friday, 30 March 2012

Custom Navigation Bar

// Name : CustomNavBar.h

#import <Foundation/Foundation.h>
@interface CustomNavBar : UINavigationBar
{}

@end
--------------------------
// Name : CustomNavBar.m

#import "CustomNavBar.h"

@implementation CustomNavBar

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}

- (void)drawRect:(CGRect)rect
{
    UIImage *image = [UIImage imageNamed:@"TopBg.png"];
    [image drawInRect: CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) ];
   
   
    [[UINavigationBar appearance] setTitleTextAttributes:
                     [NSDictionary dictionaryWithObjectsAndKeys:
                      [UIColor blackColor], UITextAttributeTextColor,
                      [UIColor whiteColor], UITextAttributeTextShadowColor,
                      [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
                      [UIFont boldSystemFontOfSize:20.0f], UITextAttributeFont,
                      nil]];

}
@end

No comments:

Post a Comment