zoukankan      html  css  js  c++  java
  • 1月18号 UIButton

    1.定义一个按钮

    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];//圆角矩形

     

    2.设置按钮大小

    button.frame = CGRectMake(100, 100, 100, 100);

    [button setFrame:CGRectMake(100, 100, 100, 100)];

     

    3.设置普通状态下的按钮

    [button setTitle:@"姓名" forState:UIControlStateNormal];//文字

    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];//字体颜色

    [button setBackgroundImage:[UIImage imageNamed:@"Unlock_DotLock1_Selected"] forState:UIControlStateNormal];//背景图片

     

     

    4.设置点击时候的按钮

    [button setTitle:@"王凯瑜" forState:UIControlStateHighlighted];

    [button setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];

    [button setBackgroundImage:[UIImage imageNamed:@"Unlock_DotLock_Wrong1" ] forState:UIControlStateHighlighted];

     

     

    5.添加到视图中

    [self.view addSubview:button];

     

    6.设置按钮能不能与用户交互

    button.enabled = NO;

    [button setTitle:@"英雄联盟" forState:UIControlStateDisabled];

     

     

  • 相关阅读:
    Python-os
    Python-字典Dict
    Linux下使用Apache搭建Web网站服务器
    Linux中FTP安装与配置
    第16章 广域网
    第15章 IPv6
    第14章 思科无线技术
    第13章 网络地址转换NAT
    第12章 安全
    第11章 虚拟局域网
  • 原文地址:https://www.cnblogs.com/hmzxwky/p/5138980.html
Copyright © 2011-2022 走看看