zoukankan      html  css  js  c++  java
  • UINavigationItem不显示

    效果如图:

    代码:

    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithNormalImage:@"MainTagSubIcon" hignlightImage:@"MainTagSubIconClick" target:self action:@selector(leftButtonClick)];

    + (instancetype)itemWithNormalImage:(NSString *)normalImage hignlightImage:(NSString*)hignlightImage target:(id)target action:(SEL)action{

        

        UIButton *buttonItem = [UIButton buttonWithType:UIButtonTypeCustom];

        

        [buttonItem setImage:kImage(normalImage) forState:UIControlStateNormal];

        [buttonItem setImage:kImage(hignlightImage) forState:UIControlStateHighlighted];

        [buttonItem addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];

         return [[self alloc]initWithCustomView:buttonItem];

    }

    原因:customView没有指定尺寸(位置不用指定)

    加了句:

    buttonItem.size = buttonItem.currentImage.size;

    效果如图:

  • 相关阅读:
    JVM 调优工具
    JVM tomcat 性能调优
    meven 新建web 项目
    垃圾收集器
    JVM 内存溢出
    JVM 常见参数配置
    垃圾回收机制策略
    MongoDB C#驱动:
    基于MSMQ绑定的WCF服务实现总结
    python _、__和__xx__的区别(转)
  • 原文地址:https://www.cnblogs.com/yintingting/p/4540981.html
Copyright © 2011-2022 走看看