-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnnotationViewController.swift
executable file
·95 lines (73 loc) · 3.47 KB
/
AnnotationViewController.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// AnnotationViewController.swift
// Gecco
//
// Created by yukiasai on 2016/01/19.
// Copyright (c) 2016 yukiasai. All rights reserved.
//
import UIKit
class AnnotationViewController: SpotlightViewController {
@IBOutlet var annotationViews: [UIView]!
var stepIndex: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
delegate = self
}
func next(labelAnimated: Bool) {
updateAnnotationView(labelAnimated)
let screenSize = UIScreen.mainScreen().bounds.size
switch stepIndex {
case 0:
// spotlightView.move(Spotlight.RoundedRect(center: 1, 110), size: CGSizeMake(150, 71), cornerRadius: 6), moveType: .Disappear)
spotlightView.appear(Spotlight.RoundedRect(center: CGPointMake(78, 100), size: CGSizeMake(150, 61), cornerRadius: 6))
case 1:
// spotlightView.move(Spotlight.Oval(center: CGPointMake(screenSize.width - 75, 42), diameter: 50))
spotlightView.move(Spotlight.RoundedRect(center: CGPointMake(screenSize.width - 56, 88), size: CGSizeMake(120, 40), cornerRadius: 6), moveType: .Disappear)
// Tap Here to Follow
case 2:
//Would you like to Follow this Class
var FollowAlert = SCLAlertView()
FollowAlert.addButton("Yes, Follow ", action: { () -> Void in
// Follow
print("Now Following")
})
FollowAlert.addButton("No, not my Class", action: { () -> Void in
// Just Cancel
})
FollowAlert.showCloseButton = false
FollowAlert.showSuccess("", subTitle: "Would you like to Follow this Class?")
spotlightView.move(Spotlight.RoundedRect(center: CGPointMake(0, 0), size: CGSizeMake(0, 0), cornerRadius: 0), moveType: .Disappear)
// break
case 3:
// Part 4, Scroll 'Where the magic Happens'
spotlightView.move(Spotlight.RoundedRect(center: CGPoint(x: screenSize.width / 2, y: screenSize.height), size: CGSize(width: screenSize.width, height: screenSize.height + 60), cornerRadius: 6), moveType: .Disappear)
case 4:
// Tap Here to Post
spotlightView.move(Spotlight.RoundedRect(center: CGPoint(x: 100, y: 270), size: CGSizeMake(120, 60), cornerRadius: 6), moveType: .Disappear)
// spotlightView.move(Spotlight.Oval(center: CGPointMake( screenSize.width / 2, 200), diameter: 220), moveType: .Disappear)
case 5:
dismissViewControllerAnimated(true, completion: nil)
default:
break
}
stepIndex += 1
}
func updateAnnotationView(animated: Bool) {
annotationViews.enumerate().forEach { index, view in
UIView .animateWithDuration(animated ? 0.25 : 0) {
view.alpha = index == self.stepIndex ? 1 : 0
}
}
}
}
extension AnnotationViewController: SpotlightViewControllerDelegate {
func spotlightViewControllerWillPresent(viewController: SpotlightViewController, animated: Bool) {
next(false)
}
func spotlightViewControllerTapped(viewController: SpotlightViewController, isInsideSpotlight: Bool) {
next(true)
}
func spotlightViewControllerWillDismiss(viewController: SpotlightViewController, animated: Bool) {
spotlightView.disappear()
}
}