2012-05-06 80 views

回答

1

如果你的目标是iOS 5中,你可以把这个代码在你的AppDelegate:

float version = [[[UIDevice currentDevice] systemVersion] floatValue]; 
if (version >= 5.0) 
{ 
    // iPhone 5.0 code here 
    UIImage *image = [UIImage imageNamed: @"image.png"]; 
    [[UIBarButtonItem appearance] setBackButtonBackgroundImage:image forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; 

} 
3

您可以使用外观代理了点。只需在您的appDelegate

- (BOOL)application:(UIApplication *)application 
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    //... 
    UIImage *myImage = [UIImage imageNamed:@"barButtonItemBackground.png"]; 
    [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setBackgroundImage:myImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; 
    return YES; 
} 

添加此有关更多详细信息检查WWDC的会议114 2011