Monday, 28 May 2012

custom navigation bar

#import <Foundation/Foundation.h>


@interface CustomNavBar : UINavigationBar {



   
}

@end

----------------------------------------
#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