Note that there are some explanatory texts on larger screens.

plurals
  1. POUIButton placed on top of tableviewcell
    primarykey
    data
    text
    <p>I have UIButton which is placed on top of each UITableviewCell . It is custom tableview . When i click on tableviewcell it goes into another tableview where (Tableview) contains the data in each cell .</p> <p>This is the way i get the details of the 2nd tableview ....<strong><em>customCellData</em></strong> is the db query method which gives out the cell number ..(Ex if i click 2nd cell of first tableview customcell returns the value ) (<strong><em>bookArray</em></strong> - contains the list of items present in 2nd cell of first tableviewcell)</p> <p>The following code is <strong>didSelectForRowAtIndexPath</strong></p> <pre><code> NSDictionary *selectedAuthor = nil; NSArray *sectionArray=[mainIndexDictionary objectForKey:[allKeysArray objectAtIndex:indexPath.section]]; selectedAuthor = [sectionArray objectAtIndex:indexPath.row]; iPath=[[selectedAuthor objectForKey:@"SymptIndexID"] intValue]; NSLog(@"iPath - %d",iPath); authortitleString=[[selectedAuthor objectForKey:@"authorIndexName"]stringByAppendingString:@" cure!"]; } bookArray=[objDB customCellData:(NSInteger)iPath]; [self.view bringSubviewToFront:authorView]; [bookTableView scrollRectToVisible:CGRectMake(0.0, 0.0, 320.0,10.0) animated:NO]; [bookTableView reloadData] </code></pre> <p>Now i want to program in such a way where .when i click on the UIButton which is there in 1st tableview it should contain the data of the 2nd tableview . I cant access indexPath since i will be doing this in seperate method <strong><em>( In didselectrowatindexpath if i give indexpath for that particular cell the indexpath is found )</em></strong></p> <p>Will anyone please help me .</p> <p><em><strong>Updated Code</em></strong> </p> <pre><code>in cellForRowAtIndexPath cell.shareFacebookButton.tag = indexPath.row; [cell.shareFacebookButton addTarget:self action:@selector(facebookShare:) forControlEvents:UIControlEventTouchUpInside]; return cell; -(IBAction)facebookShare:(id)sender { UIButton *button = (UIButton *)sender; UITableViewCell *cell = (UITableViewCell *)button.superview.superview; UITableView *tableView = (UITableView *)cell.superview; NSIndexPath *indexPath = [tableView indexPathForCell:cell]; NSInteger indexPathNumber = indexPath.row; NSLog(@"IndexPath is -- &gt; %d" , indexPathNumber); } </code></pre>
    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.
 

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