I am 开发者_Go百科working on fitting a UITextView inside a UITableView. My table is grouped style with only one section and one row. I've looked through various previous questions but I am unable to get this idea working. I want the result to be the same as the "notes" section in the Calendar app on iPad. And Apple has done the same thing in the contacts app as well for notes. Do I need to use view animations to make the tableView row keep growing dynamically as and when more and more text is typed into the textView? What is the correct overall approach to make this idea work? Any pointers would be greatly appreciated. I get the points on how to resize the textview depending on text size and how to modify the height of the table row. But how do I make these work together to give it a dynamic animated feel like in the Apple apps?
Also another thing I noticed is that the cursor always lands at the beginning of the text view due to which the text gets overwritten and ugly on appending. Is there any method to get the cursor to go to next to the last character in the textview when I tap on it again while some text already exists inside it?
Thanks
You can refer to this Post for dynamically growing your uitableviewcell.
This library can help you grow UITextView with auto layout https://github.com/MatejBalantic/MBAutoGrowingTextView
You can set-up the hooks (either in the library or you set-up the UITextView delegate) to make sure size of the table view cell get's recalculated based on the new UITextView size each time content of the text view is changed.
精彩评论