打字而动画的UITextView [英] Typing while animation UITextView

查看:195
本文介绍了打字而动画的UITextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图具有可变高度的UITextView而改变大小以适应其内容,但是,当在尺寸变化的动画帧的变化,一个或两个键击不中的UITextView捕获。动画持续时间为0.1秒,通常只错过一个字母,当你打字比较快。然而,这是在当动画发生缺字母非常一致。下面的动画块textViewDidChange中发生:代表消息:

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: delegate message:

[UIView animateWithDuration:0.1 animations:^{

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

}];

我GOOGLE和SO搜查,但到目前为止,一切都没有上来。有没有其他人遇到这个?

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

推荐答案

在默认情况下的UIView动画禁用用户交互的动画视图,因此可能(抱歉,现在不能测试)明确地实现用户互动将解决您的问题:

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){}];

这篇关于打字而动画的UITextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆