Bug 38629 - Removing child using WillRemoveSubview(UIView) method not working
Summary: Removing child using WillRemoveSubview(UIView) method not working
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 9.2
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-02-10 14:04 UTC by Dharmendar
Modified: 2016-02-10 20:32 UTC (History)
2 users (show)

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


Attachments
Replication sample (10.75 KB, application/zip)
2016-02-10 14:04 UTC, Dharmendar
Details


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:
Status:
RESOLVED ANSWERED

Description Dharmendar 2016-02-10 14:04:49 UTC
Created attachment 14981 [details]
Replication sample

Removing child using  WillRemoveSubview(UIView) method not working
but, removing child using child.RemoveFromSuperview is working fine.

Please find attached sample for replicating issue.
Comment 1 Sebastien Pouliot 2016-02-10 20:32:03 UTC
The `WillRemoveSubview` API [1] is not to remove a subview, it's the method that gets called when iOS removes one.

E.g.

	class MyView : UIView {
		public override void WillRemoveSubview (UIView uiview)
		{
		    Console.WriteLine ("view was removed");
		    base.WillRemoveSubview (uiview);
		}
	}

Overriding the method, like aboce, would allow your UIView to be notified when they are removed.

[1] https://developer.xamarin.com/api/member/MonoTouch.UIKit.UIView.WillRemoveSubview/p/MonoTouch.UIKit.UIView/