Can I add a scroll view after adding all the buttons and textFields in Xcode? Thanks! As when I do that I am not able to use any changes in view.
extension SecondViewController: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
func textFieldDidBeginEditing(_ textField: UITextField) {
if (textField == player2NameTextField || textField == player2CoinTextField ) {
scrollView2.setContentOffset(CGPoint(x: 0, y: 250), animated: true)
}
}
func textFieldDidEndEditing(_ textField: UITextField) {
scrollView2.setContentOffset(CGPoint(x: 0, y: 0), animated: true)
}
}
I am trying to auto adjust the keyboard on the screen with respect to the text field. But, it is not working. Any help would be highly appreciated. Thanks!