textview根据光标插入数据

UITableViewCell *cell =  [tableView cellForRowAtIndexPath:indexPath];
//定位光标

    NSRange range = [opinion selectedRange];
NSMutableString *top = [[NSMutableString allocinitWithString:[opinion text]];
NSString *addName = [NSString stringWithFormat:@"%@",cell.textLabel.text];
    [top insertString:addName atIndex:range.location];
    opinion.text = top;
    [top release];

posted @ 2015-12-24 08:09  Bo-tree  阅读(121)  评论(0)    收藏  举报