Skip to content

Commit 1f026f1

Browse files
Fixed action when user taps on any part of the questions VC
PauseView is now hidden with the "isHidden" property instead of using its alpha (same for the blur view)
1 parent 6af6e37 commit 1f026f1

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

Questions/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>v2.24-beta</string>
18+
<string>v2.24.1-beta</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Questions/QuestionsViewController.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class QuestionsViewController: UIViewController {
5656
goBack.setTitle("Questions menu".localized, for: .normal)
5757
mainMenu.setTitle("Main menu".localized, for: .normal)
5858
pauseButton.setTitle("Pause".localized, for: .normal)
59-
pauseView.alpha = 0.0
60-
blurView.alpha = 0.0
59+
pauseView.isHidden = true
60+
blurView.isHidden = true
6161

6262
// Theme settings
6363
loadCurrentTheme()
@@ -125,7 +125,9 @@ class QuestionsViewController: UIViewController {
125125
// MARK: Actions
126126

127127
@IBAction func tapAnyWhereToClosePauseMenu(_ sender: UITapGestureRecognizer) {
128-
self.pauseMenuAction()
128+
if !pauseView.isHidden {
129+
self.pauseMenuAction()
130+
}
129131
}
130132

131133
@IBAction func answer1Action() { verify(answer: 0) }
@@ -203,15 +205,15 @@ class QuestionsViewController: UIViewController {
203205
private func pauseMenuAction(animated: Bool = true) {
204206

205207
let duration: TimeInterval = animated ? 0.2 : 0.0
206-
let title = (pauseView.alpha == 0.0) ? "Continue" : "Pause"
208+
let title = (pauseView.isHidden) ? "Continue" : "Pause"
207209
pauseButton.setTitle(title.localized, for: .normal)
208210

209-
UIView.animate(withDuration: duration) {
210-
self.pauseView.alpha = (self.pauseView.alpha == 0.0) ? 0.9 : 0.0
211-
self.blurView.alpha = (self.blurView.alpha == 0.0) ? 1.0 : 0.0
212-
}
211+
UIView.transition(with: self.view, duration: duration, options: [.transitionCrossDissolve], animations: {
212+
self.pauseView.isHidden = !self.pauseView.isHidden
213+
self.blurView.isHidden = !self.blurView.isHidden
214+
})
213215

214-
let newVolume = (pauseView.alpha == 0.0) ? Audio.bgMusicVolume : (Audio.bgMusicVolume / 5.0)
216+
let newVolume = (pauseView.isHidden) ? Audio.bgMusicVolume : (Audio.bgMusicVolume / 5.0)
215217
Audio.setVolumeLevel(to: newVolume)
216218
}
217219

@@ -280,7 +282,7 @@ class QuestionsViewController: UIViewController {
280282
}
281283

282284
@IBAction func showPauseMenu() {
283-
if pauseView.alpha == 0.0 {
285+
if !pauseView.isHidden {
284286
pauseMenuAction(animated: false)
285287
}
286288
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Questions
22
[![Swift version](https://img.shields.io/badge/Swift-4-orange.svg)](https://swift.org/download)
3-
[![Version](https://img.shields.io/badge/version-v2.24--beta-green.svg)](https://github.com/illescasDaniel/Questions/releases)
3+
[![Version](https://img.shields.io/badge/version-v2.24.1--beta-green.svg)](https://github.com/illescasDaniel/Questions/releases)
44
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/illescasDaniel/Questions/blob/master/LICENCE)
55

66
Prototype of a Quiz app for iOS.

0 commit comments

Comments
 (0)