zoukankan      html  css  js  c++  java
  • UIButton的selected设为TRUE时在按下时显示自己定义的背景图

    在UIButton的selected设为TRUE后。须要在按钮高亮时,显示自己定义的背景图。
    经研究hightLighted和selected这两个状态是能够重叠的,就是button能够同一时候处于selectec和highlighted两个状态下。
    从UIControlState的定义也能够看出:
    typedef NS_OPTIONS(NSUInteger, UIControlState) {
        UIControlStateNormal       = 0,
        UIControlStateHighlighted  = 1 << 0,                  // used when UIControl isHighlighted is set
        UIControlStateDisabled     = 1 << 1,
        UIControlStateSelected     = 1 << 2,                  // flag usable by app (see below)
        UIControlStateApplication  = 0x00FF0000,              // additional flags available for application use
        UIControlStateReserved     = 0xFF000000               // flags reserved for internal framework use
    };


    设置这样的状态重叠情景时的背景图:
     [button setBackgroundImage:[UIImage imageNamed:@"seled_highLight.png"] forState:UIControlStateSelected| UIControlStateHighlighted];
查看全文
  • 相关阅读:
    Java8新特性(转载)
    Mysql学习笔记—时间计算、年份差、月份差、天数差(转载)
    Mysql学习笔记—concat以及group_concat的用法(转载)
    Controller中返回数据总结(ResponseEntity,@ResponseBody,@ResponseStatus)
    Java BigDecimal详解
    WebMagic简介和使用
    poi根据模板导出word文档
    谈谈ConcurrentHashMap1.7和1.8的不同实现
    JVM性能调优监控工具jps、jstack、jmap、jhat、jstat、hprof使用详解
    JAVA优化技巧分享 让游戏更加的流畅
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10610054.html
  • Copyright © 2011-2022 走看看