Mrw*_*lfy 3 xcode label uibutton uicolor
此代码似乎运行良好,修改我的按钮的属性,除了titleLabel字体颜色没有改变.我可以改变字体,字体大小,阴影而不是颜色.它目前显示为白色,虽然我试图将其设置为黑色.我试过了button1.titleLabel.textColor = [UIColor blackColor]; 和[button1.titleLabel setTextColor:[UIColor blackColor]]; 似乎认出了这个属性,但仍然保持白色.
[button1.titleLabel setTextColor:[UIColor blackColor]];
[button1.titleLabel setFont:[UIFont boldSystemFontOfSize:20]];
[button1.titleLabel setShadowColor:[UIColor blackColor]];
[button1.titleLabel setShadowOffset:CGSizeMake(-1, 1)];
[button1 setTitle:@"Do it" forState:UIControlStateNormal];
button1.frame = CGRectMake(0, 0, 250, 40.0);
[myView addSubview:button1];
Run Code Online (Sandbox Code Playgroud)
Mrw*_*lfy 17
这很有效.
[button1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23947 次 |
| 最近记录: |