iOS导航栏左边按钮图像变形

/添加一个view 用来存放btn
    UIView *iconBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 25, 25)];
    leftButton = [[CDLeftBtn alloc]init];
    leftButton.layer.masksToBounds = YES;
    leftButton.frame = CGRectMake(0, 0, 25, 25);
    leftButton.layer.cornerRadius = 12.5;
    [CDUtils displayLeftBtnImageWithUrlUnderMyIcon:icon.length>0?icon:[CDUser currentUser].avatarUrl button:leftButton];
    [iconBgView addSubview:leftButton];
    [leftButton addTarget:self action:@selector(leftBtnCilck) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithCustomView:iconBgView];
    self.navigationItem.leftBarButtonItem = leftItem;
///就是加一层,

UIView *iconBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 25, 25)];

    UIButton * backbtn =[UIButton addBtnImage:@"backimg" AndFrame:CGRectMake(0, 0, 25, 25) WithTarget:self action:@selector(leftBtnClick)];

    backbtn.layer.masksToBounds = YES;

    backbtn.layer.cornerRadius = 12.5;

    [iconBgView addSubview:backbtn];

    self.navigationItem.leftBarButtonItem =[[UIBarButtonItem alloc]initWithCustomView:iconBgView];

 

 

posted on 2018-04-17 15:50  高彰  阅读(790)  评论(0编辑  收藏  举报

导航