美文网首页
UINavigationBar返回键文字去除

UINavigationBar返回键文字去除

作者: 陆非凡 | 来源:发表于2016-12-09 15:46 被阅读183次
    QQ20161209-1.png

    想要去除这个“返回”的文字,可以这样:

    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMin, NSIntegerMin)
                                                             forBarMetrics:UIBarMetricsDefault];
    
    QQ20161209-0.png

    但是这样做在iOS9以上会有问题,后台返回会跳屏


    Untitled.gif

    找到了另外的方法,这样:

    [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor clearColor]}
                                                    forState:UIControlStateNormal];
        [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor clearColor]}
                                                    forState:UIControlStateHighlighted];
    

    相关文章

      网友评论

          本文标题:UINavigationBar返回键文字去除

          本文链接:https://www.haomeiwen.com/subject/pygemttx.html