zoukankan      html  css  js  c++  java
  • UI控件之--UIButton

    UIButton是UIControl子类,这个类提供了方法来设置标题,图像,按钮等外观属性。通过使用set方法,你可以指定一个不同的外观为每个按钮状态。

    // typedef enum {
    // UIButtonTypeCustom = 0, 自定义风格
    // UIButtonTypeRoundedRect, 圆角矩形
    // UIButtonTypeDetailDisclosure, 蓝色小箭头按钮,主要做详细说明用
    // UIButtonTypeInfoLight, 亮色感叹号
    // UIButtonTypeInfoDark, 暗色感叹号
    // UIButtonTypeContactAdd, 十字加号按钮
    // } UIButtonType;

    + (id)buttonWithType:(UIButtonType)buttonType;

       // contentEdgeInsets : 切掉按钮内部的内容

        // imageEdgeInsets : 切掉按钮内部UIImageView的内容

        // titleEdgeInsets : 切掉按钮内部UILabel的内容

        shareButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);

    UIEdgeInsets contentEdgeInsets; // default is UIEdgeInsetsZero
    UIEdgeInsets titleEdgeInsets;                // default is UIEdgeInsetsZero
    BOOL         reversesTitleShadowWhenHighlighted; // default is NO. if YES, shadow reverses to shift between engrave and emboss appearance
    UIEdgeInsets imageEdgeInsets;                // default is UIEdgeInsetsZero
    BOOL         adjustsImageWhenHighlighted;    // default is YES. 默认情况下,当按钮高亮的情况下,图像的颜色会被画深一点,如果这下面的这个属性设置为no,那么可以去掉这个功能
    BOOL         adjustsImageWhenDisabled;       // default is YES. 默认情况下,当按钮禁用的时候,图像会被画得深一点,设置NO可以取消设置
    BOOL         showsTouchWhenHighlighted;      // default is NO. 设置为yes的状态下,按钮按下会发光
    UIColor     *tintColor; // The tintColor is inherited through the superview hierarchy. See UIView for more information.
    UIButtonType buttonType;

      

    - (void)setTitle:(NSString *)title forState:(UIControlState)state    //设置标题              

    - (void)setTitleColor:(UIColor *)color forState:(UIControlState)state   //设置标题颜色

    - (void)setTitleShadowColor:(UIColor *)color forState:(UIControlState)state  //设置标题阴影颜色

    - (void)setImage:(UIImage *)image forState:(UIControlState)state;            //设置图片

    - (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state    //设置背景图片

    - (void)setAttributedTitle:(NSAttributedString *)title forState:(UIControlState)state  // 设置标题 ,标题被设定为单行,,

     

    @property(nonatomic,readonly,retain) UILabel     *titleLabel   // 直接设置titleLabel属性不显示,原因是titleLabel的frame默认是0,hidden=yes;

    @property(nonatomic,readonly,retain) UIImageView *imageView 

     

     

  • 相关阅读:
    C#读取Excel日期时间
    软件需求3个层次――业务需求、用户需求和功能需求
    软件开发中的基线
    软件开发过程(CMMI/RUP/XP/MSF)是与非
    第1章项目初始.pdf
    计算机鼓轮
    概念模型,逻辑模型,物理模型
    第0章项目管理概述.pdf
    C#中提供的精准测试程序运行时间的类Stopwatch
    Installing and configuring OpenSSH with pam_ldap for RedHat Enterprise Linux3
  • 原文地址:https://www.cnblogs.com/10-19-92/p/4914909.html
Copyright © 2011-2022 走看看