美文网首页
iOS 返回按钮

iOS 返回按钮

作者: 阶梯 | 来源:发表于2017-10-17 14:58 被阅读11次
    • 方法一:
    UIButton *backBtn =[UIButton buttonWithType:(UIButtonTypeCustom)];
    backBtn.frame = CGRectMake(0, 0, 20, 20);
    [backBtn setImage:[UIImage imageNamed:@"fanhuijiantou"] forState:UIControlStateNormal];
    backBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -7, 0, 7);
    [backBtn addTarget:self action:@selector(onLibraryButtonClicked) forControlEvents:(UIControlEventTouchUpInside)];
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithCustomView:backBtn];
    //self.navigationItem.leftBarButtonItem.width = 100*SCALE;
       
    UIBarButtonItem *placeItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    self.navigationItem.leftBarButtonItems = @[leftItem,placeItem];
    

    相关文章

      网友评论

          本文标题:iOS 返回按钮

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