//工厂方法创建button并设定样式
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//设置成禁用
//button.enabled = NO;
//设置选中
//button.selected = YES;
//UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoLight];
button.tag = 101;
button.frame = CGRectMake(320/2 - 140/2, 300, 140, 40);
//设置标题,状态正常
[button setTitle:@"present2" forState:UIControlStateNormal];
//设置标题,状态高亮
[button setTitle:@"hello" forState:UIControlStateHighlighted];
//设置标题,禁用
[button setTitle:@"disable" forState:UIControlStateDisabled];
//设置标题颜色
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//设置标题字体
button.titleLabel.font = [UIFont systemFontOfSize:14];
//设置事件
[button addTarget:self action:@selector(present:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
//设置事件,一点下就触发
[button addTarget:self action:@selector(down) forControlEvents:UIControlEventTouchDown];
//设置事件,用户按住后拖拽由内向外
[button addTarget:self action:@selector(down) forControlEvents:UIControlEventTouchDragExit];
//设置事件,用户按住后拖拽由外向内
[button addTarget:self action:@selector(down) forControlEvents:UIControlEventTouchDragEnter];