如何在UIButton
topYellowButton2 = [UIButton buttonWithType:UIButtonTypeCustom];
topYellowButton2.frame = CGRectMake(80, 0, 90, 20);
[topYellowButton2 setTitleColor:[UIColor colorWithRed:0.0 green:0.6 blue:1.0 alpha:1.0] forState:UIControlStateNormal];
答案 0 :(得分:2)
试试这个
topYellowButton2=[UIButton buttonWithType:UIButtonTypeCustom];
topYellowButton2.frame=CGRectMake(80, 0, 90, 20);
[topYellowButton2 setTitle:@"Your Title" forState:UIControlStateNormal];
答案 1 :(得分:1)
为正常和突出显示设置标题
[topYellowButton2 setTitle:@"Button Title" forControlState:UIControlStateNormal];
[topYellowButton2 setTitle:@"Button Title" forControlState:UIControlStateHighlighted];
答案 2 :(得分:0)
[topYellowButton2 setTitle:@"My Title" forState:UIControlStateNormal];
答案 3 :(得分:0)
只需添加以下行:
[topYellowButton2 setTitle:@"my button" forState:UIControlStateNormal];