#import "TestViewController.h"
#import "UIImage+Mycategory.h"
@interface TestViewController ()
@property (nonatomic,strong) UIButton *myButton;
@end
@implementation TestViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
NSArray *btnArray = @[@"颜色",@"尺寸",@"空间",@"备注"];
for (int i = 0 ; i < btnArray.count; i ++) {
float width = (self.view.frame.size.width - 20 - 15)/4;
self.myButton = [[UIButton alloc]initWithFrame:CGRectMake(10 + (width + 5) * i, 100, width , 30)];
[_myButton setBackgroundImage:[UIImage imageWithColor:[UIColor lightGrayColor]] forState:UIControlStateNormal];
[_myButton setBackgroundImage:[UIImage imageWithColor:[UIColor orangeColor]] forState:UIControlStateSelected];
[_myButton setTitle:btnArray[
iOS的UIButton单选的最佳方式
最新推荐文章于 2022-11-24 21:02:31 发布