I’ve got a UITextView inside a UIScrollView (specifically, the text view is in a UITableViewCell in a table). When I type in the text view and hit return to make some new lines (and the text in the text view becomes too long for it to contain vertically), it scrolls both the text view itself (which is okay) and the table/table cell that contains it (which I would like to prevent). Is there some way to prevent this behaviour?
- The UITableView has scrollEnabled set to NO, yet the UITextView still causes it to scroll.
- I’ve thought about subclassing UITextView and overriding scrollRectToVisible to do nothing, but I don’t mind the text view itself scrolling, I want to stop it scrolling the containing view.
- Similarly, setting scrollEnabled to NO on the text view only prevents it from scrolling, not the table/table cell.
- The text view is not obscured by the keyboard, but it seems like it still wants to move closer to the top of the screen.
For what it’s worth, I’ve finally resolved this issue by removing the UITextView from the UITableViewCell (and adding it to the view controller that contains the table view) while editing, then returning it to the UITableViewCell when finished.