问题
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