mrd3650
mrd3650

Reputation: 1391

How is the 'notes' field implemented in iOS Contacts App?

I need to create something very similar to the notes field in iOS Contacts application.

Does anyone know how to create the auto-resizing effect. I presume that the cell contains a UILabel on the left and an editable UITextView on the right.

notes field

I am aware that this question has been already asked before however the answer posted was not detailed enough and I cannot leave a comment to ask for more detail.

Any thoughts are welcome. Thanks.

Upvotes: 2

Views: 1063

Answers (1)

Caleb
Caleb

Reputation: 124997

Start with the accepted answer to this thread.

You'll set some object, possibly the table view's delegate, as the delegate of the text field in the cell. When the text view delegate gets a – textView:shouldChangeTextInRange:replacementText: message (or perhaps just -textViewDidChange:) it can calculate the required height of the text view and, if that's different from the current height, call the table's -reloadRowsAtIndexPaths:withRowAnimation: method. This will cause the table to reload the row, effectively changing the height.

Upvotes: 1

Related Questions