Thursday, January 16, 2014

Change the background of bar button in navigation bar


Web Hosting
In this tutorial, I will show you how to customized navigation bar. Today I will show you how to change the background image of bar button background image of navigation bar. Put this code in AppDelegate.m file

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIImage *barButtonImage = [[UIImage imageNamed:@"button_normal"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 6, 0, 6)];
    [[UIBarButtonItem appearance] setBackgroundImage:barButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

return YES;

}

Web Hosting
So thats it hope you enjoy this tutorial. Note that the size of the image is 40pixels in width and 30pixels in height.

No comments:

Post a Comment