Forcing UITextView to stay the same size while typing
I have a UITextView that I shrink upon bringing up the keyboard. An issue I just ran into though is as I type past the keyboard, rather than the text start scrolling, the UITextView automatically gets bigger. How can I possibly turn this off?
EDIT
This is not a subclass, this is a plain old UITextView. It's definitely resized and gets visibly bigger (the box around the text extends past the keyboard). Not sure what you mean about flexible width/height. I tried setting it to grow and shrink with the window maybe? But that did nothing for me.
开发者_开发百科I've tried changing the content size and/or frame size, that didn't help.
I agree something very odd is going on here. Still looking for why it could be resizing.
EDIT
Nevermind. A bad fix I had to force the textview to refresh was being called unexpectedly and causing it to grow.
To my knowledge, a standard UITextView with no special flags applied shouldn't do that. In fact, I don't know that a UITextView does that at all, so my response would be in the form of a question: are you sure that your UITextView is in fact resized to fit completely within the bounds of the visible area above the keyboard? Are you using a plain ol' UITextView and not a subclass? (I know that the TTTextEditor is a class from the Three20 project whose sole purpose is to grow as you type, which is why I'm suspicious about your class doing that by default)
If you want to make sure it doesn't resize, you can try turning off the flexible width and flexible height sections in the measurements tab in IB, and maybe also uncheck "auto-resizes subviews" on the UITextView's parent. Although none of these should be making a difference, turning them off may help diagnose the real problem.
精彩评论