Xamarin IOS 中的 TextField 不允许输入 [英] TextField in Xamarin IOS not allowing input

查看:47
本文介绍了Xamarin IOS 中的 TextField 不允许输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Mac 上使用 Visual Studio 在 Xamarin 中创建了一个 ios 应用程序.我修改了 SceneDelegate 以加载一个 不是 在 Storyboard 上创建的 UITabController.我这样做是为了允许更改在某些情况下显示的选项卡数量.

I have an ios App created in Xamarin with Visual Studio on the Mac. I've modified SceneDelegate to load a UITabController that is not created on the Storyboard. I've done this to allow changing the number of tabs presented in some cases.

UITabController 正在添加一个在 Storyboard 上定义的视图.此视图包含一个 TextField,此文本字段不允许文本输入.当您点击它时,不会出现键盘.

The UITabController is adding a View that is defined on the Storyboard. This view contains a TextField, this textfield does not allow text entry. When you tap it a keyboard does not appear.

是用户交互已启用.

我该如何解决这个问题?谢谢,格里

How can I fix this? Thanks, Gerry

推荐答案

我们需要将 UIScene(实际上是一个 UIWindowScene)分配给 Window 的 WindowScene 属性,因此改进 SceneDelegate.WillConnect 中的代码如下:

We need to assign the UIScene (actually a UIWindowScene) to the WindowScene property of the Window , so improve the code in SceneDelegate.WillConnect like following :

Window = new UIWindow(scene as UIWindowScene);


UIViewController vc = new MyTabController();
Window.RootViewController = vc;

Window.MakeKeyAndVisible();

这篇关于Xamarin IOS 中的 TextField 不允许输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆