-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.swift
64 lines (40 loc) · 1.86 KB
/
Test.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
59
60
61
62
63
64
//
// Test.swift
// AppMerryChristmas
//
// Created by ReasonAmu on 7/29/16.
// Copyright © 2016 ReasonAmu. All rights reserved.
//
import UIKit
class Test: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let swipeBack = UISwipeGestureRecognizer(target: self, action: #selector(Test.backController(_:)))
swipeBack.direction = .Right
self.view.addGestureRecognizer(swipeBack)
print(navigationController?.topViewController)
//-- long
let longGesture = UILongPressGestureRecognizer(target: self, action: #selector(Test.onLongGesture(_:)))
self.view.addGestureRecognizer(longGesture)
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.navigationBarHidden = true
}
func onLongGesture(longGesture : UILongPressGestureRecognizer){
if longGesture.state == .Began{
let alertController = UIAlertController(title: "", message: "Nhan giu lau tai 1 diem ", preferredStyle: .Alert)
let actionOk = UIAlertAction(title: "OK", style: .Cancel) { (test) in
print("______________________")
}
actionOk.setValue(UIColor.redColor(), forKey: "titleTextColor")
alertController.addAction(actionOk)
self.presentViewController(alertController, animated: true, completion: nil)
}
}
func backController(swipeLeft : UISwipeGestureRecognizer){
// self.navigationController?.navigationBarHidden = false
// self.navigationController?.popToRootViewControllerAnimated(true)
self.navigationController?.popViewControllerAnimated(true)
}
}