仔细看下面的代码。因为它完美地工作。尝试添加到您的应用程序中。它会起作用的
- (void)viewDidLoad {
[super viewDidLoad];
// title label - tip
UILabel *tmp=[[UILabel alloc] initWithFrame:CGRectMake(50, 50, 200, 200)];
tmp.textColor=[UIColor colorWithRed:(14.0/255.0) green:(105.0/255) blue:(128.0/255) alpha:1.0];
[tmp setFont:[UIFont fontWithName:@"Arial" size:18]]; tmp.text=@"sagar";
tmp.backgroundColor=[UIColor clearColor]; [self.view addSubview:tmp]; [tmp release];
}
现在,请仔细查看以下代码。因为它不起作用。看看这两个代码之间没有什么区别。
- (void)viewDidLoad {
[super viewDidLoad];
// title label - tip
UILabel *tmp=[[UILabel alloc] initWithFrame:CGRectMake(50, 50, 200, 200)];
tmp.textColor=[UIColor colorWithRed:(14.0/255.0) green:(105.0/255) blue:(128.0/255) alpha:1.0];
[tmp setFont:[UIFont fontWithName:@"Arial Black" size:18]]; tmp.text=@"sagar";
tmp.backgroundColor=[UIColor clearColor]; [self.view addSubview:tmp]; [tmp release];
}
我刚刚提到了#Arial Black# 而不是#Arial#。
- 但是它不起作用。
- 是因为 iPhone 不支持 =Arial Black= 吗?
我想知道为什么它不起作用。
iPhone 支持多少种不同的字体?
有清单吗?
如何将字体名称设置为 UILabel 或任何控件?(字体名称中有空格)
提前感谢您与我分享您的知识。