Is this a good way of handling this, as I use removefromsuperview alot ?

private void removeFromSuperView(UIView view) {
                        using (var super = view.Superview) {
                                view.RemoveFromSuperview();
                                var scratch = super.Subviews;   
                        }
                }


On Aug 19, 2011, at 1:53 PM, Jeff Stedfast wrote:

> Hi John,
> 
> It affects every use of RemoveFromSuperView().
> 
> Jeff
> 
> On Fri, Aug 19, 2011 at 4:28 AM, Jon Hopkins <[email protected]> wrote:
> I am adding and removing views from a UIWindow in my app delegate class.
> 
>  
> 
> if (window.Subviews.Count() > 0)
> 
>                 (window.Subviews[0] as UIView).RemoveFromSuperview();
> 
>  
> 
> Window.AddSubview(newView);
> 
>  
> 
> Does this affect every instance of RemoveFromSuperView or only 
> ViewControllers or UIViews ?
> 
>  
> 
> Thanks
> 
>  
> 
> Von: Miguel de Icaza [mailto:[email protected]] 
> Gesendet: 18 August 2011 22:03
> An: Jon Hopkins
> Cc: [email protected]
> Betreff: Re: [MonoTouch] Fixes in Monotouch 4.0.5
> 
>  
> 
> Hello,
> 
> I am installing 4.0.5 that has appeared overnight, and was browsing the
> beta page for 4.1.0
> And saw this mentioned as a bug fix...
> 
> "Views are no longer retained if they were previously removed with
> RemoveFromSuperview ()".
> 
> Is this a fix available in the stable releases too, or just for the beta
> branch?
> 
>  
> 
> You can use the workaround described here:
> 
>  
> 
> http://stackoverflow.com/questions/7088716/what-is-the-proper-way-of-changing-current-uiviewcontroller-without-a-memory-leak
> 
>  
> 
> Miguel
> 
> 
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
> 
> 

_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to