KaiserJohaan
KaiserJohaan

Reputation: 9240

iOS -touch events in a UITableViewController

I have a UITableViewController with a number of rows. When selecting a row, it expands/collapses, by increasing the height of the row.

Now my question is, how do I only make the 'select' action apply to a certain rect? For example, if each row in my tableview is 70, and then for each sub-element in the row I expand the total row hieght by 60 * number of subelements - I only want height 0 - 70 to be 'selectable', the sub-members of the row should not be. How do you do this?

Thanks

Upvotes: 0

Views: 235

Answers (1)

djromero
djromero

Reputation: 19641

It can be done using touch events, but as you are already using UITableView it seems easier (and more iPhonish) to use what tables provides you:

reloadRowsAtIndexPaths:withRowAnimation:
insertRowsAtIndexPaths:withRowAnimation:
deleteRowsAtIndexPaths:withRowAnimation:
etc.

Search a sample called "Table View Animations and Gestures" in the documentation. Just load the reference for UITableView and you'll see it on the bottom left corner sidebar.

To make non-selectable rows just change its cell selectionStyle to UITableViewCellSelectionStyleNone.

Upvotes: 1

Related Questions