Wrapping your view in a UIScrollView is really a way. Besides the delegate textFieldDidEndEditing you could sign up for UIKeyboardDidHideNotification and UIKeyboardDidShowNotification , and when you get a notification that the keyboard is hiding / showing, then scroll your view accordingly. I can send code examples for keyboard notifications if you need it :)
Edit It is clear that I would publish the code anyway - it might seem useful to someone:
You need to declare listeners for notifications:
NSObject hideObj = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification, HandleKeyboardDidHide); NSObject showObj = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow);
then your actions will look something like this:
void HandleKeyboardDidShow(NSNotification notification) { scrollView.ScrollRectToVisible(textfield.Frame, true); } void HandleKeyboardDidHide(NSNotification notification) {
Edit 2
So, if you want to remove Observers when you destroy the view, you first need to make sure that you assign NSObject when adding observers, and then use the following code to remove them:
NSNotificationCenter.DefaultCenter.RemoveObserver(showObj); NSNotificationCenter.DefaultCenter.RemoveObserver(hideObj);
Hope this helps.
source share