Mad*_*doc 4 iphone uialertview
我试图在"消息"中获取一些文本,以使我的UIAlertView变为粗体.像这样:
UIAlertView消息: 标题有些文字,新标题有些文字
我尝试过基本的html格式化(因为"/ n"适用于新行),但这对我不起作用.是否有一种简单的方法可以使一些文字变得粗体?
当然,如果没有,我总能为alertview编写一个自定义的实现,但如果有人能告诉我,如果有更简单的方法我会appriciate :)
这是您要查找的代码,而不创建自定义警报
不适用于iOS7
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"\n\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
UILabel *txtField = [[UILabel alloc] initWithFrame:CGRectMake(12.0, 25.0, 260.0, 95.0)];
[txtField setFont:[UIFont fontWithName:@"Helvetica-Bold" size:(18.0)]];
txtField.numberOfLines = 3;
txtField.textColor = [UIColor redColor];
txtField.text = @"Look at me, I am a Red and Bold Label.";
txtField.backgroundColor = [UIColor clearColor];
[alertView addSubview:txtField];
[alertView show];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10516 次 |
| 最近记录: |