Sorry, still crashes. 

using (UIView view = new UIView (new RectangleF (0, 0, Frame.Width, 
Frame.Height))) {   
        using (var image = UIImage.FromFile("assets/gallery/pic_" + idx + 
".jpg")) {
                using (var color = UIColor.FromPatternImage(image)) {
                        view.BackgroundColor = color;   
                        AddSubview (view);
                }
        }
}

-----Ursprüngliche Nachricht-----
Von: Robert Jordan [mailto:[email protected]] 
Gesendet: 01 July 2011 15:59
An: Jon Hopkins
Cc: [email protected]
Betreff: Re: [MonoTouch] 100 times Adding / removing a View + backgroundImage 
will always crash !

On 01.07.2011 15:03, Jon Hopkins wrote:
> Hi,
>
>
>
> Calling this method on a timer will always eventually crash. GC is not
> working here, and I am
>
> Completely out of ideas.....
>
...
>
> view.BackgroundColor =
> UIColor.FromPatternImage(UIImage.FromFile("assets/gallery/pic_" + idx +
> ".jpg"));
>

Try this:

using (var image = UIImage.FromFile(
        "assets/gallery/pic_" + idx + ".jpg"))
using (var color = UIColor.FromPatternImage(image) {
        view.BackgroundColor = color;
}


Robert

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

Reply via email to