UI基础之UIButton相关

UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

1、按钮透明效果

btn.alpha = 0.8;

2、按钮圆角处理

btn.layer.cornerRadius = 5;
btn.layer.masksToBounds = YES;

3、按钮文字字体大小(加粗)

btn.titleLabel.font = [UIFont boldSystemFontOfSize:13.0];

4、按钮文字、图片位置交换

btn.imageEdgeInsets = UIEdgeInsetsMake(0, 42, 0, -42);
btn.titleEdgeInsets = UIEdgeInsetsMake(0, -8, 0, 8);

5、按钮点击

[btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];

 

posted @ 2016-10-25 17:11  兔.小白  阅读(109)  评论(0编辑  收藏  举报