Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Definitely you should use the proper delegate methods instead implementing <code>UITapGestureRecognizer</code> on an <code>UITableViewCell</code>. Then you can get the informations you want pretty easily:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *theUserNameYouWantToGet = [_workflowList objectAtIndex:[indexPath row]]; } </code></pre> <p><strong>EDIT:</strong></p> <p>If you want that action not to work for the whole cell, you could subclass <code>UITableViewCell</code>, add properties to it and implement your own delegate protocol to that cell:</p> <pre><code>@protocol JWTableViewCellDelegate; @interface JWTableViewCell : UITableViewCell @property (nonatomic, retain) NSString *username; @property (nonatomic, assign) id&lt;JWTableViewCellDelegate&gt;delegate; @end @protocol JWTableViewCell &lt;NSObject&gt; - (void)tableViewCellDidClickUsername:(JWTableViewCell *)cell; @end @implementation JWTableViewCell - (void)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self setupView]; } return self; } // if you use a prototyping NIB - (void)awakeFromNib { [self setupView]; } - (void)setupView { // add gesture recognizer } - (void)handleGesture { if ([_delegate respondsToSelector:@selector(tableViewCellDidClickUsername:)]) { [_delegate tableViewCellDidClickUsername:self]; } } </code></pre> <p>Then use this in your viewController:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { JWTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuseID" forIndexPath:indexpath]; [cell setUsername:@"Paul"]; [cell setDelegate:self]; } - (void)tableViewCellDidClickUsername:(JWTableViewCell *)cell { NSString *theUserNameYouWantToGet = [cell username]; </code></pre> <p>  }</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload