Editor Looses focus and moves up when its tapped for edit in xamarin iOS

smymshrasmymshra INMember

I am using a editor control and on tapping of it i want edit the text but it moves up and not able to see the text in Xamarin iOS for android its working fine

Answers

  • MabroukMabrouk USMember ✭✭✭
    edited November 9

    Hi,

    you Need to renderer your editor and set the InputAccessoryView to null
    like :

         public class IosEditorRenderer : EditorRenderer
            {
                protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
                {
                    base.OnElementChanged(e);
                    Control.InputAccessoryView = null;
                }
            }
    

    do not Forget to set :

    [assembly: ExportRenderer(typeof(Editor), typeof(IosEditorRenderer))]

    before the Namespace ....

    I hope that helps,
    Mabrouk.

  • smymshrasmymshra INMember
    edited November 9

    Thanks Mab i tried that already in a rendrer but what it does is removes the Done button from the keyboard which is a custom one, but i want it to be intact.SI there any way .

    My rendrer code below:
    public class XEditorRenderer:EditorRenderer
    {
    protected override void OnElementChanged(ElementChangedEventArgs e)
    {
    base.OnElementChanged(e);
    Control.SelectAll(Self);
    Control.InputAccessoryView = null;
    }
    }

  • MabroukMabrouk USMember ✭✭✭

    Can you show me the full XEditorRenderer CS File?

  • smymshrasmymshra INMember

    Whatever i have mentioned above is the only one no code is there apart from this piece in the renderer

  • MabroukMabrouk USMember ✭✭✭
    edited November 10

    Because you Need to add this :

    [assembly: ExportRenderer(typeof(Editor), typeof(XEditorRenderer))]

  • smymshrasmymshra INMember
    edited November 10

    Actually this piece is already added and its working fine but as per my requirement Done button should not be removed from my keyboard and Control.InputAccessoryView = null; line removes it and your suggested code is also same.
    I am finding some way to keep Done intact.

    Thanks very much for helping.

Sign In or Register to comment.