美文网首页
UINavigationBarItem 调整距离左右边界的大小

UINavigationBarItem 调整距离左右边界的大小

作者: YNTCode | 来源:发表于2016-07-01 17:29 被阅读714次

UINavigationBarItem 调整距离左右边界的大小

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(5, 22, pixwn(44), pixwn(15));
    [button setTitle:@"取消" forState:UIControlStateNormal];
    button.titleLabel.font = kXHFont(19);
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:_button];
    
    UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]
                         initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                   target:nil action:nil];                                       
    negativeSpacer.width = -pixwn(10); //减小距离,width属性为负值,加大距离,width属性为正值
    self.navigationItem.leftBarButtonItems = @[negativeSpacer,backItem];//无论左边或者右边的item,调整间距的item放在数组的第一个

相关文章

  • UINavigationBarItem 调整距离左右边界的大小

    UINavigationBarItem 调整距离左右边界的大小

  • Latex公式图片间距

    一、LATEX调整公式与正文间距离,调整空白大小: 调整空白命令:\setlength{\abovedisplay...

  • 动态调整控件大小及距离

    RelativeLayout mRelativeLayout; //待修改的布局或控件 /**获取原先控件的大小...

  • 2018-04-11CSS属性之padding 与float

    padding属性:表示一个标签内的元素内容 距离上下左右标签内部边界的距离。 padding: 5rpx ; 表...

  • iOS11.0以后无法调整UINavigationBarItem

    在iOS11中, 发现以前修改barButton位置的方法不再奏效了, 通过查看UI层级结构发现, 从iOS11开...

  • 睡不着

    思路: 1.得到连通区域边界坐标,和mask区域边界坐标 2.判断边界坐标距离(for),if存在边界距离小于等于...

  • aws磁盘空间扩容

    1、调整卷大小2、调整分区大小3、调整文件系统大小进入控制台调整volume大小进入实例调整分区 sudo gro...

  • AutoLayout

    一般来说layoutSubviews负责布局,比如调整View之间的距离,大小,drawRect负责绘制,比如使用...

  • 自我调整的边界

    这段时间的咨询总是碰到一个相似的主题,就是来访者们总是没办法决定一个边界。不知道学习要努力到什么程度,不知道要把一...

  • 婚姻的边界距离

    有一天,我们吵了架,同一张床上,背对背睡着了。 有一天,我拿着枕头被子离开了卧室,到了沙发上。 有一天,我离家出走...

网友评论

      本文标题:UINavigationBarItem 调整距离左右边界的大小

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