@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// UIButtonTypeCustom = 0, 自定义风格
// UIButtonTypeRoundedRect, 圆角矩形
// UIButtonTypeDetailDisclosure, 蓝色小箭头按钮
// UIButtonTypeInfoLight, 亮色感叹号
// UIButtonTypeInfoDark, 暗色感叹号
// UIButtonTypeContactAdd, 十字加号按钮
button_ = [UIButton buttonWithType:UIButtonTypeRoundedRect]; //[button setTitle:@"注册" forState:UIControlStateNormal]; UIImage *normalImage = [UIImage imageNamed:@"icon_u1.png"];
UIImage *pressedImage= [UIImage imageNamed:@"icon_u10.png"]; // UIControlStateNormal 正常状态
// UIControlStateHighlighted 高亮状态
// UIControlStateDisabled 禁用状态
// UIControlStateSelected 选中状态
[button_ setBackgroundImage:normalImage forState:UIControlStateNormal];
[button_ setBackgroundImage:pressedImage forState:UIControlStateDisabled]; [button_ setFrame: CGRectMake(, , , )]; // UIControlEventTouchDown 单点触摸按下
// UIControlEventTouchDownRepeat 多点触摸按下,多个手指
// UIControlEventTouchUpInside 控件触摸的抬起事件
// UIControlEventAlltouchEvents 所有触摸事件
[button_ addTarget:self action:@selector(doClick) forControlEvents:UIControlEventTouchDown]; [self.view addSubview:button_];
} -(void)doClick{
NSLog(@"%s", __FUNCTION__);
//禁止该按钮点击
button_.enabled = NO;
} @end

最新文章

  1. HTML常用标签总结
  2. 【OpenJudge 1665】完美覆盖
  3. Mock之easymock, powermock, and mockito
  4. CodeForces 353B Two Heaps
  5. Android ListView简单实用
  6. 2、JavaScript常用互动方法
  7. 编译器错误消息: CS0234: 命名空间“Purple”中不存在类型或命名空间名称“Model”(是否缺少程序集引用?)
  8. linux c数据库备份第四版
  9. BestCoder Round #38
  10. newinstance()和new有什么区别?(转)
  11. Ios8之后, 定位的delegate不能触发的问题
  12. 使用js代码将html导出为Excel
  13. wf 2017A
  14. 【转】SQL数据库日志文件收缩
  15. python文件流
  16. 线程变量---ThreadLocal类
  17. kafka 备忘
  18. 用secureCRT操作ubuntu终端
  19. linux RPM包安装、更新、删除等操作命令简明总结, 如何查看yum安装的软件路径 ?
  20. map正序、逆序排序

热门文章

  1. Tensorflow serving的编译
  2. 自己搭建了一个简单实用的Web版记事本
  3. JS 原型链
  4. C# 通过反射获取扩展方法
  5. IO(1)
  6. 《UML大战需求分析》阅读随笔(四)
  7. 《DSP using MATLAB》示例Example5.17
  8. Git安装
  9. Unity 依赖注入之二
  10. centos7 搭建nginx和tomcat集成