20
votes

I'm having trouble with a slowdown that occurs in UITextView on iOS 7 when typing lots of text. I put a tracer in NSLayoutManager and identified that drawGlyphsForGlyphRange runs N*2 times, where N is the number of times your lines word-wrapped.

Here is the sample code:

https://github.com/philipkd/UITextViewSlow

To reproduce the problem run it on an iPad and attach a physical keyboard. Mash the letters and the space bar for about 15 seconds, and notice it slows down. Then when you try to type normally, it's really slow. That's an extreme example, but if you just try typing two paragraphs at a reasonable speed, it'll jam up.

This is not a problem with UITextView on iOS 6.

2
Good idea. I went ahead and did that. Will report back.philipkd
@Philosophistry Please post the bug report number so people can duplicate. Text views changed dramatically internally from iOS6 to iOS7. It will take time before they stabilize.Leo Natan
The Bug Report No. is 16195402philipkd
hey bro did you found any solution for this ? and what apple told you in reply ? i stuck here for 1 week. so, please help me if you have any idea.Sam
Apple asked me to repro it on the next version of iOS, but that's it. Did not find solution, but nobody is complaining in my app, though.philipkd

2 Answers

2
votes

Turn off Background App Refresh in Settings General. Also, get rid of NSLog--they slow down beyond what it takes them to print.

I was able to reproduce the slow down effect on iPad under IOS7. In fact IOS6 did not have Background App Refresh.

I believe Apple aims for top of the line models, all others have to adjust.

-1
votes

Is the slows down happen when you plugged in (Xcode debugging) your ipad to the macbook/iMac? If yes, try to unplug the cable and try it again with the cable unplugged, see if it still slows down or not. If not, then it only happen when debugging process. (It's just my guess, since I'm not owner of an external keyboard)