Right now I have a UIButton
setup in my storyboard that pushes to a Table View Controller. This is working as expected. What I am trying to do is have the
Drag your button connection to the new view and select custom Segue instead of Push or Modal.
Change the new custom Segue's class to "mySegueClass1" or what ever you'd like to call it.
Create a new Objective-C class with the same name as you just assigned to the custom segue.
Then inside your mySegueClass1.m file add the following code, and add what ever additional actions you want to -(void)perform
-(void)perform{
UIViewController *dst = [self destinationViewController];
UIViewController *src = [self sourceViewController];
[dst viewWillAppear:NO];
[dst viewDidAppear:NO];
[src.view addSubview:dst.view];
CGRect original = dst.view.frame;
dst.view.frame = CGRectMake(dst.view.frame.origin.x, 0-dst.view.frame.size.height, dst.view.frame.size.width, dst.view.frame.size.height);
[UIView beginAnimations:nil context:nil];
dst.view.frame = CGRectMake(original.origin.x, original.origin.y, original.size.height, original.size.width);
[UIView commitAnimations];
[self performSelector:@selector(animationDone:) withObject:dst afterDelay:0.2f];
}
- (void)animationDone:(id)vc{
UIViewController *dst = (UIViewController*)vc;
UINavigationController *nav = [[self sourceViewController] navigationController];
[nav popViewControllerAnimated:NO];
[nav pushViewController:dst animated:NO];
}
There is a method:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
//You can access the tableviewcontroller using segue.destinationViewController
//Maybe you want to set your model here.
}
That is called before a segue is made. Here you can do all the setup you need. You should place this method inside the controller that performs the segue, not the one receiving it. (In fact, probably xcode already put that piece of code for you).