I have a textfield within a scrollview.
When I tap into the textfield to add text, the keyboard pops up and the textfield disappears behind the keyboard. How to solve this?
The scrollview should scroll down so the textfield is still visible while typing.
I found several solutions for an Objective-C project. Unfortunately, I am using Mono Touch/C#.
I already created a delegate for the textfield.
What should I add to the method “public override void EditingStarted (UITextField textField)” to make this work?
public class CloseTextfieldDelegate : UITextFieldDelegate{
private NewReportScreen controller;
public CloseTextfieldDelegate(NewReportScreen newReportScreen)
{
controller = newReportScreen;
}
public override bool ShouldReturn (UITextField textField)
{
textField.ResignFirstResponder();
return false;
}
public override void EditingStarted (UITextField textField)
{
//DO SOMETHING (MAKE TEXTFIELD VISIBLE SO IT DOESN'T DISAPPEARS BEHIND THE KEYBOARD)
}
}
I solved the problem with the following method in the CloseTextfieldDelegate class:
I don’t think it is the best solution, but it works fine.