简体   繁体   English

UITextField / UITextView-iOS 11-高CPU使用率

[英]UITextField / UITextView - iOS 11 - High CPU Usage

I think that I found a bug in iOS 11 with Objective-C. 我认为我在使用Objective-C的iOS 11中发现了一个错误。 If you create an empty project with tons of textfields or text views, you'll see the CPU usage out of control. 如果您创建一个带有大量文本字段或文本视图的空项目,则会看到CPU使用率不受控制。 Through Instruments I discovered that the event that make the cursor / caret blinks keep being called, even if you deallocate the textfields. 通过Instruments我发现,即使取消分配了文本字段,也会使光标/插入符号闪烁的事件继续被调用。

I have a big project with 2 textfields in each row of a table and I really don't know how to fix it. 我有一个大项目,在表的每一行中都有2个文本字段,我真的不知道如何解决它。 Ironically, this event is being called even if you don't see the blinking cursor. 具有讽刺意味的是,即使您没有看到闪烁的光标,也会调用此事件。

Anyone faced this problem? 有人遇到这个问题吗?

Here it is what is being called: 这就是所谓的:

 Main Thread
      start
           0x100b2fcde
                UIApplicationMain
                     GSEventRunModal
                          CFRunLoopRunSpecific
                               _CFRunLoopRun
                                    _CFRunLoopDoTimer
                                         _DFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION_
                                              _NFFireTimer
                                                   -[UITextSelectionView caretBlinkTimerFired:]
                48%                                    - [UITextSelectionView showCaret:]
                48%                                   -[UITextSelectView hideCaret:]

PS I tried the same program on iOS 10.3 and it works fine. PS我在iOS 10.3上尝试了相同的程序,并且工作正常。

在Apple修复该问题之前,我看到用空白字符串@“”替换文本字段文本可以解决此问题。

With iOS update 11.1, problem seems to be resolved, according to my tests. 根据我的测试,使用iOS更新11.1后,问题似乎已解决。 With this update, when a UITextView or UITexField loses focus, CPU usage decreases. 通过此更新,当UITextView或UITexField失去焦点时,CPU使用率会降低。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM