Skip to content

Commit

Permalink
Merge pull request #2 from romanrakhlin/main
Browse files Browse the repository at this point in the history
Did some improvements of LearningViewController and adjusted it to IOS 15
  • Loading branch information
SkullMag committed Oct 10, 2021
2 parents 61bb486 + d5830d7 commit 78108bb
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 58 deletions.
Binary file not shown.
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Definitions.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
13 changes: 11 additions & 2 deletions Definitions/Controller/LearningViewController.swift
Expand Up @@ -14,6 +14,7 @@ class LearningViewController: UIViewController {
@IBOutlet var forgotButton: UIButton!
@IBOutlet var rememberButton: UIButton!
@IBOutlet var wordCountLabel: UILabel!
@IBOutlet weak var showDefinitionButton: UIButton!

var wordNumber = 0
var words: Array<Word>!
Expand All @@ -29,7 +30,7 @@ class LearningViewController: UIViewController {
self.definitionTextView.isEditable = false

// self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: #selector(dismissController))
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Back", style: .plain, target: self, action: #selector(dismissController))
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(dismissController))

numberOfWords = words.count

Expand Down Expand Up @@ -83,7 +84,15 @@ class LearningViewController: UIViewController {
}

@IBAction func showDefinition(_ sender: UIButton) {
self.definitionTextView.attributedText = currentWord!.attributes
if let curentText = showDefinitionButton.titleLabel?.text {
if curentText == "Show the definition" {
showDefinitionButton.setTitle("Hide the definition", for: .normal)
self.definitionTextView.attributedText = currentWord!.attributes
} else {
showDefinitionButton.setTitle("Show the definition", for: .normal)
self.definitionTextView.attributedText = NSAttributedString(string: "")
}
}
}

}

0 comments on commit 78108bb

Please sign in to comment.