在使用uibutton的时候,一般用
UIButton*buttonrecommend = [[UIButton alloc]initWithFrame:CGRectMake(0, 80, 100, 40)];
buttonrecommend.tag = 13;
[buttonrecommend setTitle:@"热门商家" forState:UIControlStateNormal];
[buttonrecommend setTitle:@"热门商家" forState:UIControlStateHighlighted];
[buttonrecommend setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
// [buttonrecommend setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
[buttonrecommend setBackgroundImage:[UIImage imageNamed:@"beijingtiao.png"] forState:UIControlStateNormal];
[buttonrecommend setBackgroundImage:[UIImage imageNamed:@"beijingtiao.png"] forState:UIControlStateHighlighted];
[buttonrecommend addTarget:self action:@selector(list:) forControlEvents:UIControlEventTouchUpInside];
设置title的时候用
buttonrecommend.titlelabel = @"热门商家";用不了原因如下