I have created a subclass of a UITableViewCell that I am using with some UILabel’s. Now I want to add a checkbox or button to this subclass. After the user clicks this button, I want to move perform a segue and pass an ID or tag.
Currently, this is what I have in the subclass. activityComplete is the button click action
- (IBAction)activityComplete:(id)sender {
NSLog(@"row: %d", activityComplete.tag);
}
In my main class, I am calling this at cellForRowAtIndexPath:
cell.activityComplete.tag = [activityId intValue];
This is currently working and it passes the ID as the tag when I click the button. The problem is, at this point I don’t know how to perform a segue. I need to call the segue from my main class but the action is happening on my subclass.
Any help would be appreciated.
If you already have a segue to the scene you wish to transition to, even if it is connected to a view other than your button, ensure that you have given the segue an Identifier in the storyboard. Then you can call the performSegueWithIdentifier:sender: method using the identifier you gave to the segue and using the button as the sender.
This will call the scene as if you had hooked up the segue directly.