美文网首页
iOS导航BarButtonItem文字或者图片与屏幕边界的间隔

iOS导航BarButtonItem文字或者图片与屏幕边界的间隔

作者: 白屏 | 来源:发表于2016-03-08 16:56 被阅读754次

    - (void)createNavigationLeftBarButtonItemWithCustomView:(UIButton *)button

    {

    UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:button];

    if ([[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue]>=7) {

    UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];

    negativeSpacer.width = -16;

    self.navigationItem.leftBarButtonItems = @[negativeSpacer, buttonItem];

    }else{

    self.navigationItem.leftBarButtonItem = buttonItem;

    }

    }

    其实测试了下左侧的item里旁边应该是16px,右侧是12px,可以去试试噢!

    http://www.tuicool.com/articles/3Ufema

    相关文章

      网友评论

          本文标题:iOS导航BarButtonItem文字或者图片与屏幕边界的间隔

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