티스토리 뷰

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
import UIKit
 
class ViewController: UIViewController ,UIPreviewInteractionDelegate{
 
    var preInteraction : UIPreviewInteraction!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        preInteraction = UIPreviewInteraction(view: view)
        preInteraction.delegate = self
    }
    
    func previewInteraction(_ previewInteraction: UIPreviewInteraction, didUpdatePreviewTransition transitionProgress: CGFloat, ended: Bool) {
        print("UpdatePreviewTransition : \(transitionProgress)")
        view.alpha = 1 - (transitionProgress / 2)
        if ended {
            print("Preview Ended")
        }
        
    }
    
    func previewInteraction(_ previewInteraction: UIPreviewInteraction, didUpdateCommitTransition transitionProgress: CGFloat, ended: Bool) {
        print("UpdateCommitTransition : \(transitionProgress)")
        view.alpha = 0.5 - (transitionProgress / 2)
        if ended {
            print("Commit Ended")
            view.alpha = 1
        }
    }
    
    func previewInteractionDidCancel(_ previewInteraction: UIPreviewInteraction) {
        print("InteractionDidCancel")
        view.alpha = 1
    }
    
}
cs


댓글
댓글쓰기 폼