I did actually make a segue from my viewcontroller to itself by using a hidden button and then another one that makes the segue. Just for the sake of clarification, say I want to change the view bg color by using a segue. The issue here is that the view returns to its first state as if I run it again because it goes through the viewdidload and the viewdidappear and so. Is there a way or a workaround that I can utilize to continue from the last state of my view?
What do I need to add to this code for example:
- (IBAction)changeColor:(id)sender {
[self performSegueWithIdentifier:@"changeC" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
ViewController* controller = [segue destinationViewController];
controller.view.backgroundColor = [UIColor blueColor];
}
I'm not even going to ask why you would ever actually want to do that, but you could just have a BOOL like shouldReloadView, and set that to NO in prepareForSegue:
. Then, within viewDidLoad
and viewWillAppear
just check for that BOOL before doing any setup.