Xamarin iOS - how can we set accessibility focus to a button programatically

一曲冷凌霜 提交于 2019-12-11 08:26:36

问题


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.

So trying to find a way to set focus to the button programmatically but it seems there is no way in 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!


回答1:


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);


来源:https://stackoverflow.com/questions/41347350/xamarin-ios-how-can-we-set-accessibility-focus-to-a-button-programatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!