I added a button on the custom cell. It pushes a view. I created property for button on CustomTableViewCell.h
@property (weak, nonatomic) IBOutlet UIButton *selectedMapButton;
I want to use selectedMapButton for push a view on TableViewController.m I tried this code, but something is not right.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cord = cellSight[@"S_Coodinates"];
[cell.selectedMapButton addTarget:self action:@selector(sightMapButton:cord) forControlEvents:UIControlEventTouchUpInside];
//When I call sightMapButton method. It gives an error
return cell;
}
- (void)sightMapButton: (NSString *)withCoordinates
{
TOCGSightseeingMapKitViewController *mapKitController = [[TOCGSightseeingMapKitViewController alloc] init];
mapKitController.sightCoordinates = withCoordinates;
[self.navigationController pushViewController:mapKitController animated:YES];
}
How can I solve it? Thanks.