如何设置标题上的UIButton
问题描述:
如何设置UIButton
如何设置标题上的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];
答
[topYellowButton2 setTitle:@"My Title" forState:UIControlStateNormal];
答
文本只需添加这一行:
[topYellowButton2 setTitle:@"my button" forState:UIControlStateNormal];
答
尝试用于本届
topYellowButton2=[UIButton buttonWithType:UIButtonTypeCustom];
topYellowButton2.frame=CGRectMake(80, 0, 90, 20);
[topYellowButton2 setTitle:@"Your Title" forState:UIControlStateNormal];
答
设置标题正常和突出显示
[topYellowButton2 setTitle:@"Button Title" forControlState:UIControlStateNormal];
[topYellowButton2 setTitle:@"Button Title" forControlState:UIControlStateHighlighted];
你忘了';'! ;) – Martin 2012-07-18 07:30:40