I have added a UIButton to my UITableViewCell and in the action of that button, I add the following code to get the index Returns the value of the cell but returns the error- 'NSINID IDArgrant exception', reason: '- [UITableViewCell indexed pathfraurecel:]: 0x7cea3fc0 sent to unknown selector for example'
Will someone tell me whether To do it, here?
- (IBAction) navigateMap: (ID) sender {__strong UIButton * button = (UIButton *) sender; UITableViewCell * cell = (UITableViewCell *) button Superview; UITableView * tableView = (UITableView *) cell. Superview; NSINxpath * IndexPath = [Tableview indexPhonesforcell: cell]; // remaining logic}
full code
- (IBAction) navigateMap: (ID) sender {__strong UIButton * button = (UIButton *) sender; UITableViewCell * cell = (UITableViewCell *) button Superview; UITableView * tableView = (UITableView *) cell. Superview; NSINxpath * IndexPath = [Tableview indexPhonesforcell: cell]; Combination stations * Inbox = [[Joint stations alloc] init]; InButton = [_ final step list object-endx: indexpath.section]; _universalRegion-> Center.latitude = inButton.latitude; _universalRegion-> Center.longitude = inButton.longitude; NSString * launchUrl = @ ""; LaunchUrl = [launchUrl stringbapping string: "" http://maps.google.com/maps?daddr= "]; NSString * tmpLat = [[NSString alloc] initWithFormat: @"% f ", _universalRegion- & gt; center Latitude]; NSString * tmpLong = [[NSString alloc] initWithFormat: @ "% f", _universalRegion-> center; lame]; NSString * llat = [tmpLat stringbapping string; [@ ", stringbapping string: TMPLOG]]; LaunchUrl = [@ "http://maps.google.com/maps?daddr=" stringbapping stringing: wave]; Launch url = [launch url stringbapping string: [@ "and sad =" stringbapping string: @ "current location"]]; [[UIApplication shared application] Opal: [NSL URL Youth Ringtones: [Launch url stringingBaspingfepsupping encoding: NSTF 8 string encoding]]];
Try it, it would be an easy way to get index pf table.
- (IBAction) navigateMap: (ID) sender {CGPoint Button Status = [Sender Convert Point: CGPointZero toView: tableViewName]; NSIndexPath * indexPath = [tableViewName indexPathForrowoutpoint: buttonpages]; }
No comments:
Post a Comment