Iphone 如何设置UIButton上的标题
如何在Iphone 如何设置UIButton上的标题,iphone,Iphone,如何在ui按钮上设置文本 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];
ui按钮上设置文本
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 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];
[topYellowButton2 setTitle:@"Button Title" forControlState:UIControlStateNormal];
[topYellowButton2 setTitle:@"Button Title" forControlState:UIControlStateHighlighted];