Nippysaurus
Nippysaurus

Reputation: 20378

UITableViewController - disable selection

How can the ability to select cells in a Cocoa Touch TableView be completely disabled?

I have managed to get my code to a state where selection seems not possible, but if you hold your finger on a cell for a moment or two it will turn blue (selected) until you move off it.

How can it be completely disabled?

Upvotes: 8

Views: 5357

Answers (3)

Samuel
Samuel

Reputation: 124

NSData *archivedView = [NSKeyedArchiver archivedDataWithRootObject:cell.backgroundView];
cell.selectedBackgroundView = [NSKeyedUnarchiver unarchiveObjectWithData:archivedView];

you can do this by configuring the cell

Upvotes: 0

imaginaryboy
imaginaryboy

Reputation: 5989

See the allowsSelection property of UITableView.

myTableView.allowsSelection = NO;

Upvotes: 23

Aaron Saunders
Aaron Saunders

Reputation: 33345

from the apple documentation on Gesture Recognizers

Generally, a window delivers UITouch objects (packaged in UIEvent objects) to a gesture recognizer before it delivers them to the attached hit-test view. But there are some subtle detours and dead-ends in this general delivery path that depend on whether a gesture is recognized. You can alter this delivery path to suit the requirements of your application.

so... I haven't actually implemented this, but have done some reading on it... It might be a possible solution

Upvotes: 1

Related Questions