CustomizationViewController now changes layout depending on the device's orientation

This commit is contained in:
Deniz Duezgoeren
2019-09-20 18:11:27 +02:00
parent 67d6c5329e
commit 7acddfbfd9
8 changed files with 218 additions and 96 deletions
+19 -1
View File
@@ -24,10 +24,21 @@ class CustomizationViewController: UIViewController, UICollectionViewDataSource,
@IBOutlet weak var defaultSegments: UISegmentedControl!
@IBOutlet weak var textToolbar: UIToolbar!
@IBAction func textDismissButton(_ sender: Any) {
@IBOutlet weak var inputsView: UIView!
@IBOutlet weak var colourView: UIView!
@IBAction func textDismissButton(_ sender: UIBarButtonItem) {
view.endEditing(true)
}
@IBAction func groupHelpButton(_ sender: UIButton) {
self.present(self.getAlert(for: "grade"), animated: true)
}
@IBAction func courseHelpButton(_ sender: UIButton) {
self.present(self.getAlert(for: "course"), animated: true)
}
func textFieldDidBeginEditing(_ textField: UITextField) {
textField.inputAccessoryView = textToolbar
}
@@ -126,4 +137,11 @@ class CustomizationViewController: UIViewController, UICollectionViewDataSource,
cell.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
return cell
}
func getAlert(for type: String) -> UIAlertController {
let alert = UIAlertController(title: NSLocalizedString("enter_\(type)_title", comment: ""), message: NSLocalizedString("enter_\(type)_help", comment: ""), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("dismiss", comment: ""), style: .default) { action in
})
return alert
}
}