zoukankan      html  css  js  c++  java
  • UIButton的基础知识

    摘自:欧阳大神的UI教学视频

    UIButton 的类型

    1、UIButtonTypeRoundedRect 圆角按钮

    2、UIButtonTypeDetailDisclosure 详情按钮

    3、UIButtonTypeContactAdd 加号按钮

    4、UIButtonTypeInfoDark 白色信息按钮

    5、UIButtonTypeInfoLight 灰色信息按钮

    6、 UIButtonTypeCustom 自定义按钮

    UIButton的常用属性

    1、frame 坐标

    2、tag 标签

    3、adjustsImageWhenHighlighted 高亮状态下按钮是否变暗

    4、adjustsImageWhenDisabled 禁用状态下按钮是否变暗

    5、showsTouchWhenHighlighted 按钮高亮状态下是否发光

    UIButton的常用方法

    1、- (void)setTitle:(NSString *)title forState:(UIControlState)state;

    2、- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;

    3、- (void)setTitleShadowColor:(UIColor *)color forState:forState:(UIControlState)state;

    4、- (void)setImage:(UIImage *)image forState:(UIControlState)state;

    5、- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;

    6、- (void)setTintColor:(UIColor *)color;

    UIButton 的事件

    1、- (void)addTarget:(id)target action:(SEL)action forControlEvent:(UIControlEvents)controlEvents

    2、- (void)removeTarget:(id)target action:(SEL)action forControlEvent:(UIControlEvents)controlEvents

    UIButton修改图片和标题位置

    1、默认情况下从工厂方法中生成的按钮,图片在左边,标题在右边

    2、通过继承UIButton重写方法来设置自己想要的位置

    3、按钮类型需为UIButtonTypeCustom

  • 相关阅读:
    APB协议
    AHB总线协议(一)
    C++内存机制中内存溢出、内存泄露、内存越界和栈溢出的区别和联系
    深入理解C++内存管理机制
    c/c++内存机制(一)(转)
    与临时对象的斗争(下)
    与临时对象的斗争(上)ZZ
    C++异常处理解析: 异常的引发(throw), 捕获(try catch)、异常安全
    qt5信息提示框QMessageBox用法
    红黑树
  • 原文地址:https://www.cnblogs.com/durwards/p/4509621.html
Copyright © 2011-2022 走看看