このセグを作成するには、UIStoryBoardSegue
ファイルを作成する必要があります。そのファイルに 、このコードを配置:
override func perform() {
var firstVCView = self.sourceViewController.view as UIView!
var secondVCView = self.destinationViewController.view as UIView!
// Get the screen width and height.
let screenWidth = UIScreen.mainScreen().bounds.size.width
let screenHeight = UIScreen.mainScreen().bounds.size.height
// Specify the initial position of the destination view.
secondVCView.frame = CGRectMake(0.0, -screenHeight, screenWidth, screenHeight)
firstVCView.frame = CGRectMake(0.0, 0.0, screenWidth, screenHeight)
// Access the app's key window and insert the destination view above the current (source) one.
let window = UIApplication.sharedApplication().keyWindow
window?.insertSubview(secondVCView, aboveSubview: firstVCView)
// Animate the transition.
UIView.animateWithDuration(0.4, animations: {() -> Void in
firstVCView.frame = CGRectOffset(firstVCView.frame, 0.0, screenHeight)
secondVCView.frame = CGRectOffset(secondVCView.frame, 0.0, screenHeight)
}) { (Finished) -> Void in
self.sourceViewController.presentViewController(self.destinationViewController as! UIViewController,
animated: false,
completion: nil)
}
}
コントロールがセグエを作成します。 「カスタム」を選択します。次に、属性インスペクタでセグファイル名を入力します。あなたのカスタムセグは行きたい!
これが役に立った。
これは役立つかもしれません... http://stackoverflow.com/questions/32514836/how-to-add-bottom-swipe-up-view-ios/32516167#32516167 –
多分この記事は次のように役立ちます:http: //stackoverflow.com/a/26569703/3178126それは、カスタムプッシュとポップトランジションを行う方法を教えてくれます。この例ではアルファをアニメーション化しますが、ビューのトランスフォームのプロパティをアニメートすることもできます。 –