常用方法
self.newBtn = ({
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.layer.cornerRadius = (48) / 2;
btn.layer.borderWidth = 1;
btn.layer.borderColor = [UIColor colorWithHexString:@"#CCCCCC"].CGColor;
[btn setImage:[UIImage imageNamed:@"nav_wihet"] forState:UIControlStateNormal];
[btn setImage:[UIImage imageNamed:@"nav_wihet"]
forState:UIControlStateSelected];
[btn setFrame:CGRectMake(0, 0, 48, 44)];
[btn setImageEdgeInsets:UIEdgeInsetsMake(10, 10, 10, 10)]; //扩大响应区范围设置图片对应边距
[btn setTitle:[NSString stringWithFormat:@" %@",[@"Face Filter" localString]] forState:UIControlStateNormal];
btn.titleLabel.font = [UIFont systemFontOfSize:15];
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(fullScreenAction) forControlEvents:UIControlEventTouchUpInside];
btn;
});
网友评论