User Tools

Site Tools

Creating directory /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021 failed
Writing /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021/qs_data.ser failed

Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







objective-c:examples:indexpath_for_custom_cell

indexPath.row for IBAction Button in a Custom Cell

to get the indexPath.row for a IBAction Button in your Custom Cell simply do this

/**
* 1. Connect the Button from the Custom Cell to your ViewController.h as IBAction
* 2. add the following code to your ViewController.m
*/
 
- (IBAction)buildButton:(id)sender forEvent:(UIEvent *)event {
 
    UIButton *button = (UIButton *)sender;
    UITableViewCell *cell = (UITableViewCell *)button.superview;
    UITableView *tableView = (UITableView *)cell.superview;
    NSIndexPath *indexPath = [tableView indexPathForCell:cell];
 
    NSLog(@"IBAction Button selected row %d", indexPath.row);
}

output

  2013-03-24 12:45:54.519 cppApp[6017:c07] IBAction Button selected row 2
advertising
objective-c/examples/indexpath_for_custom_cell.txt · Last modified: 2013/03/24 12:30 by Daniel Gohlke

Impressum Datenschutz

Creating directory /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021 failed
Writing /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021/misc_data.ser failed
Creating directory /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021 failed
Writing /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021/ip.ser failed
Creating directory /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021 failed
Writing /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021/pages.ser failed
Creating directory /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021 failed
Writing /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021/ua.ser failed
Creating directory /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021 failed
Writing /kunden/homepages/20/d423760527/htdocs/cpp/data/meta/quickstats/10_2021/page_users.ser failed