我将字体设置为UITextView
。有用。我还通过选择UITextView
中的文字,将UITextView
中输入的文字设为粗体。我的问题是,如果我给
字体大小我不能使文本加粗。
答案 0 :(得分:0)
self.txtView.text=@“Life is an opportunity , Don’t west your time !”;
NSMutableAttributedString * string = [[NSMutableAttributedString alloc]initWithString:self.txtView.text];
NSString *word= @"Life is an opportunity";
NSRange range=[self..txtView.text rangeOfString:word];
[string addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:range];
[self.txtView setAttributedText:string];
[self.txtView setFont:[UIFont fontWithName:@"Montserrat-Bold" size:15]];
self.txtView.alpha=1;