Instead of injecting code into each view controller that you need to customize, I would recommend doing this for the entire application by putting something like this in your application:didFinishLaunchingWithOptions: method in the App Delegate of the application
// Nav bar [[UINavigationBar appearance] setBackgroundImage:[[UIImage imageNamed:@"navBar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 5, 10, 5)] forBarMetrics:UIBarMetricsDefault]; // Back buttons [[UIBarButtonItem appearance] setBackButtonBackgroundImage:[UIImage imageNamed:@"backNavButton.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; // Toolbar [[UIToolbar appearance] setBackgroundImage:[[UIImage imageNamed:@"toolbar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 5, 10, 5)] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
iwasrobbed
source share