-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathMessageViewController.swift
58 lines (42 loc) · 1.75 KB
/
MessageViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Created by Pete Callaway on 26/06/2014.
// Copyright (c) 2014 Dative Studios. All rights reserved.
//
import UIKit
class MessageViewController: UIViewController, UIViewControllerTransitioningDelegate {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.commonInit()
}
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.commonInit()
}
func commonInit() {
self.modalPresentationStyle = .Custom
self.transitioningDelegate = self
}
// ---- UIViewControllerTransitioningDelegate methods
func presentationControllerForPresentedViewController(presented: UIViewController, presentingViewController presenting: UIViewController, sourceViewController source: UIViewController) -> UIPresentationController? {
if presented == self {
return CustomPresentationController(presentedViewController: presented, presentingViewController: presenting)
}
return nil
}
func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if presented == self {
return CustomPresentationAnimationController(isPresenting: true)
}
else {
return nil
}
}
func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if dismissed == self {
return CustomPresentationAnimationController(isPresenting: false)
}
else {
return nil
}
}
}