實現方式就是繼承UIStoryboardSegue類,然後重寫Perform方法,然後在Storyboard上將類設置為自定義的類
這段代碼的作用是創建從中心漸變充滿屏幕的動畫
-(void)perform{ UIViewController * svc = self.sourceViewController; UIViewController * dvc = self.destinationViewController; [svc.view addSubview:dvc.view]; [dvc.view setFrame:svc.view.frame]; [dvc.view setTransform:CGAffineTransformMakeScale(0.1, 0.1)]; [dvc.view setAlpha:0.0]; [UIView animateWithDuration:1.0 animations:^{ [dvc.view setTransform:CGAffineTransformMakeScale(1.0, 1.0)]; [dvc.view setAlpha:1.0]; } completion:^(BOOL finished) { // [dvc.view removeFromSuperview]; }]; }最後的示意