How to enable void “didSelectRowAtIndexPath” and disable it?


I search didSelectRowAtIndexPath this key word

And found most problem is how to trigger it

But my question is how to enable it with another conditions

You can check my last question here - <a href="https://stackoverflow.com/questions/4213710/add-radio-button-in-tableview-got-some-problem" rel="nofollow">How to add a radio button in tableview</a>

how To disable this void when the radio button is not selected ???

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {}


I'm a bit confused by your question, but from what I can tell, you want to prevent a tableView row from being selected under certain conditions? For that you'll want to use tableView:willSelectRowAtIndexPath:. If you return nil from that method the tableView will not select a row. You may find it helpful to read <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html" rel="nofollow">the documentation</a> for UITableViewDelegate.


Well I guess you need to run the code within the method conditionally. If your radiobutton is enabled, just run it, if not, return nil (or the other way round). You cannot prevent the method from being called at all, however.


according to your radio button state set the cell property

cell.userInteractionEnabled = NO;


  • Height of tableView's header
  • Set UITableView BackgroundColor Universally with UIAppearance
  • Delete object in core data, failed to match the Swift Array Element type
  • How to subscribe to an event without preventing garbage collection?
  • Auto Height of UICollectionView inside UITableViewCell
  • Is it possible to disable esc/F11 key during full screen mode of webpage, programmatically?
  • Protecting critical code from being called again
  • How to protect the mp3 file from read or copy on Android?
  • Why does Apple use assign rather than weak to store a delegate?
  • UICollectionView in UITableview - Get tag of tapped UICollectionView
  • change color of jstree node
  • Changing media screen makes div overlay
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • cordova is not defined - cordova.js has already been loaded :: Ionic
  • Image map in Flex
  • Who propagate bugfixes across branches (corporate development)?
  • Bash if statement with multiple conditions
  • How does this usort cmp function actually work?
  • Tamper-proof configuration files in .NET?
  • MySQL Order by column = x, column asc?
  • Admob requires api-13 or later can I not deploy on old API-8 phones?
  • Allowing both email and username for authentication
  • Android fill_parent issue
  • Get one-time binding to work for ng-if
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Adding a button at the bottom of a table view
  • jQuery show() function is not executed in Safari if submit handler returns true
  • javascript inside java/jsp code
  • WinForms: two way TextBox problem
  • How do you troubleshoot character encoding problems?
  • jquery mobile loadPage not working
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • How to disable jQuery.jplayer autoplay?
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • EntityFramework adding new object to nested object collection
  • Checking variable from a different class in C#
  • Django query for large number of relationships
  • failed to connect to specific WiFi in android programmatically
  • How to push additional view controllers onto NavigationController but keep the TabBar?
  • How can I use threading to 'tick' a timer to be accessed by other threads?