Hi
Question, when i am going to write in my iOS App i cannot see the field where i am writing when the keyboard comes out it cover the field.
so how i solve that problem that the screen goes up to see the field.
Hi
Question, when i am going to write in my iOS App i cannot see the field where i am writing when the keyboard comes out it cover the field.
so how i solve that problem that the screen goes up to see the field.
I have a solution in one of my apps but it isn’t completely functional yet.
I’ll try to make an example project as soon as possible
ok
thanks
HI
this is the code to do the screen move but how i convert to XOJO code
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var txtName: UITextField!
@IBOutlet weak var txtBC: NSLayoutConstraint!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
NotificationCenter.default.addObserver(self, selector: #selector(keyBoardWillShow(notification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyBoardWillHide(notification:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
txtName.delegate = self
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
@objc func keyBoardWillShow(notification: Notification){
if let userInfo = notification.userInfo as? Dictionary<String, AnyObject>{
let frame = userInfo[UIKeyboardFrameEndUserInfoKey]
let keyBoardRect = frame?.cgRectValue
if let keyBoardHeight = keyBoardRect?.height {
self.txtBC.constant = keyBoardHeight
UIView.animate(withDuration: 0.5, animations: {
self.view.layoutIfNeeded()
})
}
}
}
@objc func keyBoardWillHide(notification: Notification){
self.txtBC.constant = 60.0
UIView.animate(withDuration: 0.5, animations: {
self.view.layoutIfNeeded()
})
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Quick and Dirty solution:
https://www.jeremieleroy.com/upload/iOSScrollableArea_KeyboardFix.xojo_binary_project
Thanks
Work perfects for practice to learn more
Xojo Need to Add this function in IOS so other no have this problems.
I actually don’t know why APPLE hasnt done something with this. I have created subclasses of TextField and Textview that automatically determine if the field needs to move, and by how much and slides the view up / down accordingly.
hi jeremie
How i can get values from iOSScrollableArea_AutoScroll and display on the screen from NotificationBlock
thanks