Hi,

 

Good news, bad news. If I use a UIImageView, then it works fine, running
up to 500+ iterations without a problem.

My change is simple

 

private void myTimer2 ()

                                {

                                                InvokeOnMainThread
(delegate {

                                                                

                                                                if
(this.Subviews != null) {

 
for (int x=0; x<this.Subviews.Length; x++) {

 
var sv = this.Subviews[x];

 
sv.RemoveFromSuperview ();

 
sv.Dispose ();

 
sv = null;

 
}

                                                                }


 
GC.Collect();

                

                                                                var idx
= (globalcounter % 4) + 1;

 
globalcounter++;

 


                                                                using
(UIImageView view = new UIImageView (new RectangleF (0, 0, Frame.Width,
Frame.Height))) {

 
using (UIImage image = UIImage.FromFile("assets/i" + idx + ".jpg")) {

 
view.Image = image;

 
AddSubview (view);

 
}

                                                                }

                                                });

                                                

                                                trace ("added " +
globalcounter);

                                }

 

L . Unfortunately, I need a UIView. Did I find a monotouch bug?

 

Jon

 

..broken version                          

                                                      

                                                                using
(UIView view = new UIView (new RectangleF (0, 0, Frame.Width,
Frame.Height))) {

 
using (UIImage image = UIImage.FromFile("assets/i" + idx + ".jpg")) {

 
using (UIColor color = UIColor.FromPatternImage(image)) {

 
view.BackgroundColor = color;

 
AddSubview (view);

 
}

 
}

                                                                }

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

Reply via email to