I'm just looking for a way to detect which Segue Identifier activated the current viewController. I'm in need of doing this as I have conditions that might not be met, but can be referenced from another viewController, which then I'd like to highlight a few labels using that specific segue ID. Has anyone needed to do this before? How did you approach this?
Probably you should create on your "current view controller" a property to store the name of the segue and then on the controller which uses the segue to instantiate your "current view controller" you assign it before fire the segue execution:
ObjectiveC:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier] isEqualToString:@"YourSegueName"]) {
// Get destination view
CurrentVC *vc = [segue destinationViewController];
// Get button tag number (or do whatever you need to do here, based on your object
vc.segueName = @"YourSegueNam";
}}
Swift 3:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "YourSegueName"
{
if let destinationVC = segue.destination {
destinationVC.segueName = segue.identifier
}
}
}
Is that what you need? Let me know. Anyway I still do not know why you want to do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With