Xamarin iOS-我们如何通过编程将可访问性焦点设置为按钮 [英] Xamarin iOS - how can we set accessibility focus to a button programatically

查看:89
本文介绍了Xamarin iOS-我们如何通过编程将可访问性焦点设置为按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的xamarin ios应用程序中,用户需要选择起始日期和截止日期以加载一些数据。为此,提供了两个按钮,因此将显示单击每个按钮的日期选择器。

In my xamarin ios application user need to choose "from date" and "to date" to load some data. For this there are two buttons provided so that clicking on each button date picker will be presented.

问题是从日期选择器中选择起始日期后,可访问性焦点将移至屏幕顶部,因为预期的行为是将焦点集中在日期

The problem is after choosing "from date" from date picker the accessibility focus is going to top of the screen, where as the expected behaviour is to focus "to date" button.

因此,试图找到一种以编程方式将焦点设置到按钮上的方法,但xamarin ios中似乎没有办法。

So trying to find a way to set focus to the button programmatically but it seems there is no way in xamarin ios.

我已经通过,它们在本机ios代码中可用,但在Xamarin ios中不可用。在xamarin ios上仅

I have gone through this and this which are available in native ios code but not in Xamarin ios. Found only this on xamarin ios.

有人可以在这方面帮助我!

Can someone help me out in this regard!

推荐答案

您链接的代码在Xamarin中绝对可用.iOS。这是一个翻译:

The code you linked is absolutely available in Xamarin.iOS. Here is a translation:

Obj-c:

UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,  self.myFirstElement);

C#:

UIAccessibility.PostNotification(UIAccessibilityPostNotification.ScreenChanged, myFirstElement);

这篇关于Xamarin iOS-我们如何通过编程将可访问性焦点设置为按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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