iOS11后导航栏返回按钮自定义

2018-04-18  本文已影响12人  airron
    UIImage * backImage = [[UIImage imageNamed:@"title_back_icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [UINavigationBar.appearance setBackIndicatorImage:backImage];
    [UINavigationBar.appearance setBackIndicatorTransitionMaskImage:backImage];

    if(@available(iOS 11, *)) {
        [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor clearColor]} forState:UIControlStateNormal];
        [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor clearColor]} forState:UIControlStateHighlighted];
    } else {
        [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-60, -60) forBarMetrics:UIBarMetricsDefault];
    }

[转自StackOverFlow](https://stackoverflow.com/questions/46193204/custom-back-indicator-image-and-ios-11)
上一篇下一篇

猜你喜欢

热点阅读