标签:label 按钮 elf nts class tsm 文字 btn hup
- (UIButton *)navSearBtn { if (!_navSearBtn) { _navSearBtn = [[UIButton alloc]init]; _navSearBtn.backgroundColor = [UIColor clearColor]; _navSearBtn.titleLabel.font = DEF_FontSize_14; [_navSearBtn setTitle:@"请输入关键词搜索" forState:UIControlStateNormal]; [_navSearBtn setImage:[UIImage imageNamed:@"搜索"] forState:UIControlStateNormal]; [_navSearBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -330 / WIDTH_6S_SCALE)]; //按钮中文字靠最左边 // _navSearBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; //根据需求调整按钮中文字位置 [_navSearBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -120 / WIDTH_6S_SCALE, 0, 0)]; _navSearBtn.layer.borderColor = [UIColor whiteColor].CGColor; _navSearBtn.layer.borderWidth = 1; [_navSearBtn addTarget:self action:@selector(navSearBtnAction:) forControlEvents:UIControlEventTouchUpInside]; _navSearBtn.layer.cornerRadius = 5 / HEIGHT_6S_SCALE; _navSearBtn.layer.masksToBounds = YES; } return _navSearBtn; }
标签:label 按钮 elf nts class tsm 文字 btn hup
原文地址:http://www.cnblogs.com/dujiahong/p/7998431.html