Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Unwind segue in iOS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 335
    Comment on it

    To Use Unwind Segues in iOS. 1- Create three controller using storyBoard
    2- Push from FirstViewControleller to SecondViewController
    3- Push From SecondViewController to Third

    Write a function in FirstViewController like this

    -(IBAction)prepareForUnwind:(UIStoryboardSegue *)segue {
        if ([segue.identifier isEqualToString:@"ThirdViewID"]) {
            ThirdViewController *threeVC = (ThirdViewController *)segue.sourceViewController;
            NSLog(@"color are %@", threeVC.mySelectedColor);
        }}
    


    4 - Create two button with title "Red" & "Blue"
    5-Drag Home button on thirdViewcontroller to the Exit outlet to create our Unwind Segue
    6- Write ibaction for two button "Red" & Blue like this

    - (IBAction)redAction:(id)sender {
        self.mySelectedColor = @"Red";
        [self performSegueWithIdentifier:@"ThirdViewID" sender:self];
    }
    - (IBAction)blueAction:(id)sender {
        self.mySelectedColor = @"Blue";
        [self performSegueWithIdentifier:@"ThirdViewID" sender:self];
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: