Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Do you want single Button for all cells in table view or you want to add button as subview on each cell</p> <p>1.if you want to add button as subview on each cell </p> <p>a) Add button with tag value equals to <code>indexPath.row</code> and set target to single method for each button.</p> <p>ex</p> <pre><code> -(void)infoButonTapped:(UIButton *)sender; </code></pre> <p>Now on Click on button find the tag value of button and get the info from the array which you use to populate <code>UITableViewCell</code>s.</p> <p>b) Now create a infoview and add textview on it and set info as text prop of text view and add infoview as subview of view using <code>UIView</code> Animation and hide on next click </p> <p>you can either use a bool variable in .h file to know hide or show infoView or you can check if infoview has superview then you have to hide infoview else add infoview as subview of self.view.</p> <ol> <li>if you want a common button for all Cell</li> </ol> <p>a) Now on click of button get <code>indexPath</code> for selected cell of tableview using tableview method </p> <pre><code>- (NSIndexPath *)indexPathForSelectedRow; </code></pre> <p>this method either return indexpath for selected cell or nil in case no cell selected</p> <p>Use indexpath for get info from the array and add infoview as subview to view using step 1.b explained above.</p> <p>you can also get the rect of selected row for setting the cordinate for the info view by method of tableview</p> <pre><code>- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath; </code></pre>
 

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