如何在xamarin.ios

时间:2018-08-15 09:29:37

标签: c# xamarin.ios keyboard keydown uikeycommand

我在弹出页面中有渲染器。弹出页面具有此渲染器:

class ExtendedGridRenderer : VisualElementRenderer<Grid>
{
    protected override void OnElementChanged(ElementChangedEventArgs<Grid> e)
    {
        e.NewElement.BackgroundColor = Color.White;

        this.Layer.CornerRadius = 5f;

        base.OnElementChanged(e);
    }

    public override UIKeyCommand[] KeyCommands
    {
        get
        {
            UIKeyCommand tabKey = UIKeyCommand.Create(new NSString("\t"), 0, new ObjCRuntime.Selector("Excute"), new NSString("tab"));

            UIKeyCommand cmdNKey = UIKeyCommand.Create(new NSString("N"), UIKeyModifierFlags.Command, new ObjCRuntime.Selector("Excute"), new NSString("cmd+N"));

            UIKeyCommand[] keyCommands = { tabKey, cmdNKey };

            return keyCommands;
        }
    }

    [Export("Excute")]
    private void Excute()
    {

    }
}

当我单击tab或cmd + N时,UIKeyCommands无法响应。另外,我在Mac上长按cmd却没有任何反应。我想做的就是听物理键盘的选项卡和cmd +N。

我在弹出页面(https://github.com/rotorgames/Rg.Plugins.Popup)上使用nuget

我跟踪键盘命令,键盘命令有2个对象

此代码有什么问题?

0 个答案:

没有答案