GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Instructions/Example/MixedCoachMarksViewController.swift at master · nirajjoshi/Instructions

Expand file tree

/

MixedCoachMarksViewController.swift

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
146 lines (113 loc) · 5.94 KB
/

MixedCoachMarksViewController.swift

Copy path

File metadata and controls

146 lines (113 loc) · 5.94 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// MixedCoachMarksViewsViewController.swift
//
// Copyright (c) 2015 Frédéric Maquin <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import UIKit
import Instructions
// This class mix different kind of coach marks together.
internal class MixedCoachMarksViewsViewController: ProfileViewController, CoachMarksControllerDataSource {
//MARK: - IBOutlet
@IBOutlet var answersLabel: UILabel?
//MARK: - Private properties
private let swipeImage = UIImage(named: "swipe")
private let answersText = "That's the number of answers you gave."
//MARK: - View Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
self.coachMarksController?.dataSource = self
self.coachMarksController?.overlayBackgroundColor = UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 0.5)
}
//MARK: - Protocol Conformance | CoachMarksControllerDataSource
func numberOfCoachMarksForCoachMarksController(coachMarksController: CoachMarksController) -> Int {
return 5
}
func coachMarksController(coachMarksController: CoachMarksController, coachMarksForIndex index: Int) -> CoachMark {
var coachMark : CoachMark
switch(index) {
case 0:
coachMark = coachMarksController.coachMarkForView(self.handleLabel)
case 1:
coachMark = coachMarksController.coachMarkForView(self.emailLabel)
case 2:
coachMark = coachMarksController.coachMarkForView(self.postsLabel)
case 3:
coachMark = coachMarksController.coachMarkForView(self.answersLabel)
case 4:
coachMark = coachMarksController.coachMarkForView(self.reputationLabel)
default:
coachMark = coachMarksController.coachMarkForView()
}
coachMark.gapBetweenCoachMarkAndCutoutPath = 6.0
return coachMark
}
func coachMarksController(coachMarksController: CoachMarksController, coachMarkViewsForIndex index: Int, coachMark: CoachMark) -> (bodyView: CoachMarkBodyView, arrowView: CoachMarkArrowView?) {
var bodyView : CoachMarkBodyView
var arrowView : CoachMarkArrowView?
switch(index) {
case 0:
let coachMarkBodyView = CustomCoachMarkBodyView()
var coachMarkArrowView: CustomCoachMarkArrowView? = nil
coachMarkBodyView.hintLabel.text = self.handleText
coachMarkBodyView.nextButton.setTitle(self.nextButtonText, forState: .Normal)
var width: CGFloat = 0.0
if let handleLabel = self.handleLabel {
width = handleLabel.bounds.width
}
if let arrowOrientation = coachMark.arrowOrientation {
coachMarkArrowView = CustomCoachMarkArrowView(orientation: arrowOrientation)
coachMarkArrowView!.plate.addConstraint(NSLayoutConstraint(item: coachMarkArrowView!.plate, attribute: .Width, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: width))
}
bodyView = coachMarkBodyView
arrowView = coachMarkArrowView
case 1:
let coachViews = coachMarksController.defaultCoachViewsWithArrow(true, arrowOrientation: coachMark.arrowOrientation)
coachViews.bodyView.hintLabel.text = self.emailText
coachViews.bodyView.nextLabel.text = self.nextButtonText
bodyView = coachViews.bodyView
arrowView = coachViews.arrowView
case 2:
let coachViews = coachMarksController.defaultCoachViewsWithArrow(true, arrowOrientation: coachMark.arrowOrientation)
coachViews.bodyView.hintLabel.text = self.postsText
coachViews.bodyView.nextLabel.text = self.nextButtonText
bodyView = coachViews.bodyView
arrowView = coachViews.arrowView
case 3:
let coachViews = coachMarksController.defaultCoachViewsWithArrow(true, arrowOrientation: coachMark.arrowOrientation)
coachViews.bodyView.hintLabel.text = self.answersText
coachViews.bodyView.nextLabel.text = self.nextButtonText
bodyView = coachViews.bodyView
arrowView = coachViews.arrowView
case 4:
let coachMarkBodyView = TransparentCoachMarkBodyView()
var coachMarkArrowView: TransparentCoachMarkArrowView? = nil
coachMarkBodyView.hintLabel.text = self.handleText
if let arrowOrientation = coachMark.arrowOrientation {
coachMarkArrowView = TransparentCoachMarkArrowView(orientation: arrowOrientation)
}
bodyView = coachMarkBodyView
arrowView = coachMarkArrowView
default:
let coachViews = coachMarksController.defaultCoachViewsWithArrow(true, arrowOrientation: coachMark.arrowOrientation)
bodyView = coachViews.bodyView
arrowView = coachViews.arrowView
}
return (bodyView: bodyView, arrowView: arrowView)
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.