If I understand your problem well, this code can do the trick:
- (void)textViewDidChange:(UITextView *)textView
{
NSString *text = _textView.text;
NSArray *elements = [text componentsSeparatedByString:@" "];
if ([elements count] > 0)
{
_label.text = [elements objectAtIndex:0];
}
}
source
share