如何在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=[UIButton buttonWithType:UIButtonTypeCustom];
topYellowButton2.frame=CGRectMake(80, 0, 90, 20);
[topYellowButton2 setTitle:@"Your Title" forState:UIControlStateNormal];

关于iphone - 如何在UIButton上设置标题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11536250/

10-13 06:35