iOS 导航栏butto添加

作者: coco_CC | 来源:发表于2017-07-12 14:35 被阅读5次

    添加左侧右侧button

    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
        [btn addTarget:self action:@selector(myBtn:) forControlEvents:UIControlEventTouchUpInside];
        [btn setImage:[UIImage imageNamed:@"mx_btn_back_phone" ] forState:UIControlStateNormal];
        [btn setImage:[UIImage imageNamed:@"mx_btn_back_phone" ] forState:UIControlStateHighlighted];
        btn.imageEdgeInsets = UIEdgeInsetsMake(0, -31, 0, 0);
        UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
        self.navigationItem.leftBarButtonItem = backItem;
        self.navigationItem.rightBarButtonItem = backItem;
    

    随手笔记整理下!
    ✧(≖ ◡ ≖✿)

    相关文章

      网友评论

        本文标题:iOS 导航栏butto添加

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