通过继承自定义返回按钮的属性

2017-06-09  本文已影响0人  nasy_iOS
UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStylePlain target:self action:@selector(backAction:)];
UIImage *image = [UIImage imageNamed:@"navigationbar_back"];
[backBarButtonItem setBackButtonBackgroundImage:[image resizableImageWithCapInsets:UIEdgeInsetsMake(0, image.size.width, 0, 0)] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[backBarButtonItem setBackButtonTitlePositionAdjustment:UIOffsetMake(-400.f, 0) forBarMetrics:UIBarMetricsDefault];
backBarButtonItem.imageInsets = UIEdgeInsetsMake(0, -30, 0, 30);
self.navigationItem.backBarButtonItem = backBarButtonItem;
上一篇 下一篇

猜你喜欢

热点阅读