首先在storyboard裏面定義連線,連的線,而後設置爲custom的類型 spa
而後新增一個UIStoryboardSegue的子類重寫它的-(void)perform 方法 code
再把segue的屬性segue class設置爲你本身新建的那個segue的子類 orm
-(void)perform{ UIViewController *dest = self.destinationViewController; UIViewController *src = self.sourceViewController; CGRect f = src.view.frame; CGRect originalSourceRect = src.view.frame; f.origin.y = f.size.height; [UIView animateWithDuration:0.3 animations:^{ src.view.frame = f; } completion:^(BOOL finished) { src.view.alpha = 0 ; dest.view.frame = f; dest.view.alpha=0.0f; [src.view.superview addSubview:dest.view]; [UIView animateWithDuration:0.3 animations:^{ dest.view.frame = originalSourceRect; dest.view.alpha = 1.0f; } completion:^(BOOL finished) { [dest.view removeFromSuperview]; src.view.alpha = 1.0f; [src.navigationController pushViewController:dest animated:NO]; }]; }]; }