Bug 17514 - Overriding GetView causes strange behaviour
Summary: Overriding GetView causes strange behaviour
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.0.6.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-01-30 12:01 UTC by Dean Cleaver
Modified: 2016-05-24 21:11 UTC (History)
4 users (show)

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

Shows provided UIViews off to the right. (24.47 KB, image/png)
2014-01-30 12:01 UTC, Dean Cleaver

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 Dean Cleaver 2014-01-30 12:01:17 UTC
Created attachment 5949 [details]
Shows provided UIViews off to the right.

Previously this code had been working (and still works fine in 7.0.5.x), but in 7.0.6 it causes problems on the device only - in the simulator, it seems to work just fine:

public override UIView GetView(MonoTouch.UIKit.UIPickerView picker, int row, int component, UIView view)
		UILabel label = new UILabel();

		label.Frame = new System.Drawing.RectangleF(0, 0, this.GetComponentWidth(picker, component), this.GetRowHeight(picker, component));

		if (BaseViewController.IsIOS7OrBetter)
			label.TextAlignment = UITextAlignment.Center;
			label.Font = UIFont.BoldSystemFontOfSize(Defaults.LargeFontSize);

		label.Text = "  " + this.GetTitle(picker, row, component);
		label.TextColor = this.GetTextColor(picker, row, component);
		label.BackgroundColor = UIColor.Clear;

		return label;
	catch (Exception ex)
		return null;

Changing this line:

label.BackgroundColor = UIColor.Clear;


label.BackgroundColor = UIColor.Red;

I was able to create the attached image. The list is only scrollable if you move the very right hand edge where the red images are.

If I comment out the above code, and change my background back to white, the UIPickerView does show correctly, so it's something in the implementation of GetView - has anything changed in there since 7.0.5?
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-01-30 18:52:36 UTC
Looks like there seem to be a bug with UIPicker:

Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-01-30 18:55:09 UTC
Dean, could you attach a complete test project we can try out?
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-02-10 07:16:00 UTC
This is probably a dup of bug #17597 (with a test project we'd be able to confirm this).
Comment 4 Rolf Bjarne Kvinge [MSFT] 2014-02-17 08:26:08 UTC
Can you try Xamarin.iOS 7.0.7 from the beta channel and see if that version fixes the issue for you?
Comment 5 Dean Cleaver 2014-02-18 21:55:49 UTC
Hi Rolf,

Sorry - we just released a new version to Apple today and I want to leave it a few days (we have it running at a live site also) in case we have to re-submit a new one - I just don't want any beta stuff on my machine for these few days. Will get onto it ASAP when I can.
Comment 6 nicolas.dougoud 2014-02-25 06:04:21 UTC
I had a similar issue: Picker content created via GetView and nothing was displayed on a device (working on the simulator). Taking Xamarin.iOS 7.0.7  fixes the issue.
Comment 7 Sebastien Pouliot 2016-05-24 21:11:05 UTC
Last comment suggest it was fixed (like comment #4).

If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!