开发者

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 - How to add a radio button in tableview

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 the documentation 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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜