开发者

Typing while animation UITextView

开发者 https://www.devze.com 2023-03-23 04:36 出处:网络
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 U

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

精彩评论

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

关注公众号