//初始化
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
//设置frame
button.frame = CGRectMake(40, 250, 60, 40);
//设置指定状态下得标题
[button setTitle:@"登陆" forState:UIControlStateNormal];
//获取指定状态下的标题
NSString *normaTitle = [logButton titleForState:UIControlStateNormal];
// 为按钮添加事件,指定按钮点击之后,执行target的action方法
[button addTarget:self action:@selector(login:) forControlEvents:UIControlEventTouchUpInside];
// 移除按钮的点击事件
[button removeTarget:self action:@selector(login:) forControlEvents:UIControlEventTouchUpOutside];
[button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
UIColor *normalYitleColor = [button titleColorForState:UIControlStateNormal];
//设置字体颜色
[button setTitleShadowColor:[UIColor redColor] forState:UIControlStateNormal];
UIColor *normalTitleShadowColor = [button titleColorForState:UIControlStateNormal];
//设置字体
[button setTitle:@"你好" forState:UIControlStateHighlighted];