How to dynamically pop up and hide UIPickerView in iOS (Xamarin C#) game?

本小妞迷上赌 提交于 2019-12-07 16:12:17

问题


I have seen a very good example of implementing UIPickerView at:

Picker in Xamarin.iOS available

However, my scenario is a little more complex than that because I don't want to constantly display the picker on the screen. Instead, I want to dynamically display and hide the picker in my game as needed.

Specifically, here is what I want to implement:

(A) First, on my game screen, when users click on a button called "Choose Background Color", I will need to pop up a picker that shows 3 values: Red, Blue, and Green.

(B) Next, users can scroll through the list of the colors inside the picker, and choose any of these 3 colors.

(C) After the users officially choose a color, I will need to close (or hide) the picker from the screen.

(D) Finally, I will display the color that the users select in step (C).


I think I can implement step (D) easily. But, my main question is this: in step (C), how do we know when exactly the users finish selecting a color so that I can dynamically hide the picker ? The users may scroll back and forth many times to look at all 3 colors, and so, it may be difficult to know when exactly the users finally make a choice.

Or is it reasonable to expect that after users finish selecting a color, they will click on any space outside the picker ? Is it the standard behavior ?

Or, instead of using pickers, should I write my own customized "RADIO BUTTON" ? (Unfortunately, iOS does not have the standard radio buttons. Therefore, it will take a lot of time to design my own customized radio button controls...) Or, can you recommend another iOS standard control for this case ?

I would greatly appreciate your answers to my questions or your suggestions on how to solve my technical issue.

Furthermore, if you can show me any sample code for step (C) or (A) and (B) and (D), I would definitely appreciate very much too. Mainly, I am not sure how to handle step (C), which is the main point of my question.

BTW, I can only write code in C# with Xamarin.iOS. So, it will be wonderful if you can show me the code in C#.

Thank you so much.

来源:https://stackoverflow.com/questions/39887140/how-to-dynamically-pop-up-and-hide-uipickerview-in-ios-xamarin-c-game

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