2

怎么设置文字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];
4

4 回答 4

2

尝试这个

topYellowButton2=[UIButton buttonWithType:UIButtonTypeCustom]; 
topYellowButton2.frame=CGRectMake(80, 0, 90, 20);
[topYellowButton2 setTitle:@"Your Title" forState:UIControlStateNormal];
于 2012-07-18T07:28:35.113 回答
1

为正常和突出显示设置标题

[topYellowButton2 setTitle:@"Button Title" forControlState:UIControlStateNormal];
[topYellowButton2 setTitle:@"Button Title" forControlState:UIControlStateHighlighted];
于 2012-07-18T07:30:03.480 回答
0

只需添加这一行:

[topYellowButton2 setTitle:@"my button" forState:UIControlStateNormal];
于 2012-07-18T07:28:09.660 回答
0
[topYellowButton2 setTitle:@"My Title" forState:UIControlStateNormal];
于 2012-07-18T07:26:36.027 回答