开发者

Typing while animation UITextView

I'm trying to have a variable-height UITextView which changes size to accomodate its contents, but when the frame changes in the size-change animation, one or two keystrokes aren't captured in the UITextView. The animation duration is 0.1s, and typically it only misses one letter when you're typing fairly fast. It is, however, very consistent in missing letters when the animation happens. The following animation block occurs within the textViewDidChange: del开发者_JS百科egate message:

[UIView animateWithDuration:0.1 animations:^{

    [textView setFrame:CGRectMake(...)];

}];

I've Googled and searched on SO, but so far nothing has come up. Has anyone else encountered this?


By default UIView animations disable user interaction for animated view, so possibly (sorry cannot test it now) explicitly enabling user interaction will solve your problem:

[UIView animateWithDuration:0.1 
        delay:0.0
        options: UIViewAnimationOptionAllowUserInteraction
        animations:^{    
            [textView setFrame:CGRectMake(...)];
        }    
        completion:^(void){}];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜