嗨,我正在做一个申请.在那里我需要以不同的字体显示文本.我的意思是,如果我用一种字体显示名称,我用不同的字体显示城市名称. UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(
          UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(50, 50, 200, 100)];
textView.text = @"Vijay Apple Dev";
NSString *textViewText = textView.text;
NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:textViewText];
[attributedText addAttribute:NSFontAttributeName
                       value:[UIFont fontWithName:@"Courier" size:20]
                       range:[textViewText rangeOfString:@"Apple"]];
[attributedText addAttribute:NSFontAttributeName
                       value:[UIFont fontWithName:@"Verdana" size:20]
                       range:[textViewText rangeOfString:@"Vijay"]];
textView.attributedText = attributedText;
[self.view addSubview:textView];
        
             