Begin working on settings app UI/content
This commit is contained in:
60
awkbd/KeyboardViewController.swift
Normal file
60
awkbd/KeyboardViewController.swift
Normal file
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// KeyboardViewController.swift
|
||||
// awkbd
|
||||
//
|
||||
// Created by Elizabeth Cray on 1/8/25.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class KeyboardViewController: UIInputViewController {
|
||||
|
||||
@IBOutlet var nextKeyboardButton: UIButton!
|
||||
|
||||
override func updateViewConstraints() {
|
||||
super.updateViewConstraints()
|
||||
|
||||
// Add custom view sizing constraints here
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
// Perform custom UI setup here
|
||||
self.nextKeyboardButton = UIButton(type: .system)
|
||||
|
||||
self.nextKeyboardButton.setTitle(NSLocalizedString("Next Keyboard", comment: "Title for 'Next Keyboard' button"), for: [])
|
||||
self.nextKeyboardButton.sizeToFit()
|
||||
self.nextKeyboardButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
self.nextKeyboardButton.addTarget(self, action: #selector(handleInputModeList(from:with:)), for: .allTouchEvents)
|
||||
|
||||
self.view.addSubview(self.nextKeyboardButton)
|
||||
|
||||
self.nextKeyboardButton.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
|
||||
self.nextKeyboardButton.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
|
||||
}
|
||||
|
||||
override func viewWillLayoutSubviews() {
|
||||
self.nextKeyboardButton.isHidden = !self.needsInputModeSwitchKey
|
||||
super.viewWillLayoutSubviews()
|
||||
}
|
||||
|
||||
override func textWillChange(_ textInput: UITextInput?) {
|
||||
// The app is about to change the document's contents. Perform any preparation here.
|
||||
}
|
||||
|
||||
override func textDidChange(_ textInput: UITextInput?) {
|
||||
// The app has just changed the document's contents, the document context has been updated.
|
||||
|
||||
var textColor: UIColor
|
||||
let proxy = self.textDocumentProxy
|
||||
if proxy.keyboardAppearance == UIKeyboardAppearance.dark {
|
||||
textColor = UIColor.white
|
||||
} else {
|
||||
textColor = UIColor.black
|
||||
}
|
||||
self.nextKeyboardButton.setTitleColor(textColor, for: [])
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user