(That goes for the add code as well -- anything that involves manipulating
UIViews. I don't know for sure that this is your problem but it's a good
rule of thumb in GUI systems regardless.)

On Fri, Jul 1, 2011 at 9:11 AM, David Moles <[email protected]>wrote:

> Try invoking the actual removal code on the main thread (with
> NSObject.InvokeOnMainThread or NSObject.BeginInvokeOnMainThread) and see if
> that helps.
>
>
> On Fri, Jul 1, 2011 at 7:10 AM, Jon Hopkins <[email protected]>wrote:
>
>> 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
>>
>
>
>
> --
> David Moles
> [email protected]
>
>


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

Reply via email to