Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c UITextView变更事件_Objective C_Uitextview - Fatal编程技术网

Objective c UITextView变更事件

Objective c UITextView变更事件,objective-c,uitextview,Objective C,Uitextview,我使用这个简单的代码来检测textView的任何更改 - (void)textViewDidChange:(UITextView *)textView { NSUInteger length; length = [textView.text length]; NSLog(@"%@",[NSString stringWithFormat:@"%u", length]); } 是否可以增加特定字符的大小 如果用户输入3个字符,则第二个字符的大小应增加+5 例如: if

我使用这个简单的代码来检测textView的任何更改

- (void)textViewDidChange:(UITextView *)textView
{
    NSUInteger length;
    length = [textView.text length];
    NSLog(@"%@",[NSString stringWithFormat:@"%u", length]);
}
是否可以增加特定字符的大小

如果用户输入3个字符,则第二个字符的大小应增加+5

例如:

   if (length == 3)
{

_textView.text = [_textView.font fontWithSize:_textView.font.pointSize + 5];
/// Here is the problem, I don't know how to increase size only for second character


}

有什么想法吗?

您需要使用
NSAttributedString
并设置文本视图的
attributedText
属性。@rmaddy您的意思是,使用interface builder中的attributedText吗?如果我使用interface builder中的attributedText,我必须键入一些文本,否则不起作用,我的意思是在代码中。