Question

How would I change the text on the search bar induced keyboard from "search" to "cancel" or "done"

I can change the keyboard type:

((UISearchBar)TableView.TableHeaderView).KeyboardType = UIKeyboardType.CHOICE
Was it helpful?

Solution

In order to get at the ReturnKeyType -

foreach (UIView subView in ((UISearchBar)TableView.TableHeaderView).Subviews)
{
    var view = subView as IUITextInputTraits;
    if (view != null)
    {
        view.KeyboardAppearance = UIKeyboardAppearance.Default;
        view.ReturnKeyType = UIReturnKeyType.Done;
    }
}

This work for my use case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top