自定义UINavigationBar上面的按钮

定制回退按钮

1  UIImage *buttonBack30 = [[UIImage imageNamed:@"button_back_textured_30"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 5)];
2  UIImage *buttonBack24 = [[UIImage imageNamed:@"button_back_textured_24"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 12, 0, 5)];
3  [[UIBarButtonItem appearance] setBackButtonBackgroundImage:buttonBack30
                                                  forState:UIControlStateNormal
                                                barMetrics:UIBarMetricsDefault];
4  [[UIBarButtonItem appearance] setBackButtonBackgroundImage:buttonBack24
                                                  forState:UIControlStateNormal
                                                barMetrics:UIBarMetricsLandscapePhone];

设置右侧按钮

1 UIImage *button30 = [[UIImage imageNamed:@"button_textured_30"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
2 UIImage *button24 = [[UIImage imageNamed:@"button_textured_24"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
3 [[UIBarButtonItem appearance] setBackgroundImage:button30
4                                             forState:UIControlStateNormal
5                                           barMetrics:UIBarMetricsDefault];
6 [[UIBarButtonItem appearance] setBackgroundImage:button24
7                                             forState:UIControlStateNormal
8                                           barMetrics:UIBarMetricsLandscapePhone];
原文地址:https://www.cnblogs.com/sell/p/2915535.html