Bug 19873 - UIPickerView Selected method is confused
Summary: UIPickerView Selected method is confused
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.2.2
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-05-18 00:35 UTC by 999komi
Modified: 2016-05-24 21:45 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Monotouch solution (1.66 MB, application/zip)
2014-05-18 00:35 UTC, 999komi
mov file of wrong behavior (5.73 MB, video/quicktime)
2014-05-20 10:46 UTC, 999komi

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description 999komi 2014-05-18 00:35:51 UTC
Created attachment 6829 [details]
Monotouch solution

It seems to be acting like a UITableView selected method -- it is firing when you tap on a row.  That's the wrong behavior for a UIPickerView.

See the attached solution.  I was running in Xamarin Studio on my iMac.  I've copy-pasted the Xamarin Studio info below:

=== Xamarin Studio ===

Version 4.2.5 (build 0)
Installation UUID: 1c8993d0-f2e1-4e7b-85de-51473c2779ee
	Mono 3.2.6 ((no/9b58377)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 302060000

=== Xamarin.Android ===

Version: 4.12.3 (Business Edition)
Android SDK: /Users/william/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: db4427f
Build date: 2014-04-22 12:49:14-0400

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Build Information ===

Release ID: 402050000
Git revision: 95ac543f224a70960a9ab71e24ce341eb87de06f
Build date: 2014-05-02 13:05:15-04
Xamarin addins: b81285ac0156281956135adb96685f98922893a1

=== Operating System ===

Mac OS X 10.9.2
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-05-19 04:28:53 UTC
UIPickerViewModel.Selected is the managed method for UIPickerViewDelegate's pickerView:didSelectRow:inComponent: selector [1], which is called when the user selects a row.

As far as I can see this is what the test app is doing - exactly which behaviour were you expecting?

[1] https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UIPickerViewDelegate_Protocol/Reference/UIPickerViewDelegate.html#//apple_ref/occ/intfm/UIPickerViewDelegate/pickerView:didSelectRow:inComponent:
Comment 2 Ram Chandra 2014-05-19 06:25:05 UTC
I tried this issue and I am able to reproduce this issue.

I have checked this with attached project and I observed that when I tap on the row it calls the "Selected" method of "SimplePickerModel" class. 

I have checked the definition of "Selected" method of "UIPickerViewModel" class in "assembly browser" and observed that the "Selected method" is using following attribute for runtime binding.

		public virtual void Selected(UIPickerView picker, int row, int component)

I have also checked the apple doc and it says that "pickerView:didSelectRow:inComponent:" called by the picker view when the user selects a row in a component.

Apple doc: "https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UIPickerViewDelegate_Protocol/Reference/UIPickerViewDelegate.html#//apple_ref/occ/intfm/UIPickerViewDelegate/pickerView:didSelectRow:inComponent:"

Screencast: http://www.screencast.com/t/Hy2S5onl3uk1

Environment Info:

Mac OS X 10.9.2
Xamarin Studio :5.0 (build 866)
Xamarin.iOS : (Business Edition)

Build Information
Release ID: 500000866
Git revision: 89cfcdd28a9a64d4ddc606f8c4f8e6aaafad610a
Build date: 2014-05-12 14:59:13-04
Xamarin addins: e92a35a9280dede5cbdceaaec0c40c06c163546e
Comment 3 999komi 2014-05-19 11:38:30 UTC
Rolf, you may not be familiar with how a UIPickerView is supposed to behave. Selected is supposed to fire when you move the picker to a row, not when you tap on it.  But in the test app, you can't even move the picker.

For an example of correct behavior of a UIPickerView, try downloading my app "Free Graphing Calculator" from the iTunes app store, and hit the "Units" key on the main screen.  Notice that you can scroll the picker.  Every time you do so, the "selected" method will fire.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2014-05-20 05:07:12 UTC
Just so that we're talking about the same thing, this is a screencast of what I see: http://screencast.com/t/TsyefQMJj

Is this how you expect it to behave?

I downloaded your app, and as far as I can see the test case from this bug behaves the same.
Comment 5 999komi 2014-05-20 09:46:46 UTC
No, that looks like correct behavior.  Let me see if I can figure out how to do a screencast.
Comment 6 999komi 2014-05-20 10:46:23 UTC
Created attachment 6845 [details]
mov file of wrong behavior
Comment 7 Rolf Bjarne Kvinge [MSFT] 2014-07-24 08:31:12 UTC
I've been unable to reproduce the behavior you see.

Does it happen on a device as well?+ And can you try the latest beta (v7.2.6) and see if that changes anything?´
Comment 8 Sebastien Pouliot 2016-05-24 21:45:54 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!