将您的按钮连接拖到新视图并选择自定义Segue而不是Push或Modal。
![enter image description here](https://i.stack.imgur.com/L2u98.png)
更改新的自定义Segue公司的类“mySegueClass1”或什么都你想调用它。
![enter image description here](https://i.stack.imgur.com/WEPen.png)
具有相同的名称创建一个新的Objective-C类,你刚刚分配到自定义SEGUE。
然后你mySegueClass1.m文件中添加以下代码,并添加你什么都想要更多的行动,以-(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];
}
我刚刚有机会实现此代码今天(妻子有一个孩子),它的作品完美。花时间做出如此彻底的回应,我感激不尽。 – cmutchler 2012-03-09 22:28:39
什么都没问题,恭喜! – 2012-03-09 22:32:05