uibutton设置

UIButton *selectMore = [UIButton buttonWithType:UIButtonTypeCustom];
            selectMore.frame = CGRectMake(0, __kScreenHeight - 42, __kScreenWidth / 2, 42);
           // UIButton *selectMore = [[UIButton alloc] initWithFrame:CGRectMake(0, __kScreenHeight - 42, __kScreenWidth / 2, 42)];
            NSString *filePath = [[NSBundle mainBundle] pathForResource:@"selectMore" ofType:@"png"];
           // [selectMore setBackgroundImage:[UIImage imageWithContentsOfFile:filePath] forState:UIControlStateNormal];
            [selectMore setBackgroundColor:__kColorWithRGB(240, 241, 243, 1)];
            [selectMore setTitle:@"选择更多商品" forState:UIControlStateNormal];
            [selectMore setTitle:@"选择更多商品" forState:UIControlStateHighlighted];
            selectMore.titleLabel.font = [UIFont boldSystemFontOfSize:22];
            //selectMore.titleLabel.textColor = [UIColor greenColor];
            [selectMore setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
            [selectMore addTarget:self action:@selector(moreClick:) forControlEvents:UIControlEventTouchUpInside];
            [self.view addSubview:selectMore];
            _selectMoreBtn = selectMore;

原文地址:https://www.cnblogs.com/NSNULL/p/4597138.html