Bug 18744 - UIRefreshControl cannot be removed from UITableView
Summary: UIRefreshControl cannot be removed from UITableView
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 7.2.1
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
Depends on:
Reported: 2014-04-02 10:36 UTC by René Ruppert
Modified: 2014-04-02 14:00 UTC (History)
3 users (show)

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

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 René Ruppert 2014-04-02 10:36:53 UTC
If I try to get rid of a UIRefreshControl of a UITableView by calling

tableView.RefreshControl = null;

I get the exception below. According to this post http://stackoverflow.com/questions/19480424/how-do-i-hide-a-uirefreshcontrol setting the control to NULL is the correct way to remove it.

{System.ArgumentNullException: Argument cannot be null.
Parameter name: value
  at MonoTouch.UIKit.UITableViewController.set_RefreshControl (MonoTouch.UIKit.UIRefreshControl value) [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UITableViewController.g.cs:986 
  at SDSClient_iOS.Controllers.BaseInlineMenuListController.EnablePullToRefresh (Boolean enable) [0x00092] in y:\Documents\Develop\Projects\SSP Europe\SDS Clients Mobile\SDSClient_iOS\Controllers\BaseInlineMenuListController.cs:309 
  at SDSClient_iOS.Controllers.FavoritesListController.ViewDidLoad () [0x00030] in y:\Documents\Develop\Projects\SSP Europe\SDS Clients Mobile\SDSClient_iOS\Controllers\FavoritesListController.cs:33 
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 
  at SDSClient_iOS.Application.Main (System.String[] args) [0x00001] in y:\Documents\Develop\Projects\SSP Europe\SDS Clients Mobile\SDSClient_iOS\Main.cs:15 }
    base: {System.ArgumentException}

=== Xamarin Studio ===

Version 4.3.4 (build 0)
Installation UUID: 220dde4a-6e9c-4c80-a89e-6ef72bea0759
	Mono 3.2.7 ((no/40f92d5)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 302070000

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 46b2486
Build date: 2014-03-24 15:04:26-0400

=== Xamarin.Android ===

Version: 4.12.3 (Business Edition)
Android SDK: /Users/rene/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.3   (API level 18)
		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)

=== Build Information ===

Release ID: 403040000
Git revision: e2e118a56ebf05c9f15eafbf53379bdebded727c
Build date: 2014-03-12 15:39:07-04
Xamarin addins: 9f2eb9aed862e28ca23d2d2f34e22952087e6e4c

=== Operating System ===

Mac OS X 10.9.2
Darwin iMacBuero.local 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
Comment 1 Sebastien Pouliot 2014-04-02 13:03:07 UTC
It should be nullable, per docs quote [1], so it's a binding bug (it very uncommon to have a null-by-default property that cannot be set back to null).

> The default value of this property is nil.

[1] https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UITableViewController/refreshControl
Comment 2 Sebastien Pouliot 2014-04-02 14:00:46 UTC
Fixed in master d5e84610cd11e14299b8a08b095100a38e68c3bd

QA: unit test added in the same revision

@René the workaround is to directly send the null to the UITableViewController, e.g.

Messaging.void_objc_msgSend_IntPtr (tvc.Handle, Selector.GetHandle ("setRefreshControl:"), IntPtr.Zero);