Hi,

 

Calling this method on a timer will always eventually crash. GC is not
working here, and I am

Completely out of ideas.....

 

                Public class viewSwitcher : UIView

                .....

Globalcounter=0;

                var timer =
NSTimer.CreateRepeatingScheduledTimer(TimeSpan.FromSeconds(.5),
myTimer);

.....

 

                private void myTimer() {

                                                // remove previous view

 

                                                if (Subviews.Length > 0)
{

                                                                UIView
sv = Subviews[0];

 
sv.RemoveFromSuperview();

 
sv.BackgroundColor.Dispose();

 
sv.Dispose();

                                                                sv =
null;                        

                                                }


 

                                                // add new view

 

                                                using  (UIView view =
new UIView(new RectangleF(0,0,768,1024))) {

                                                                var idx=
(globalcounter % 4) + 1;

 
globalcounter++;

 
view.BackgroundColor =
UIColor.FromPatternImage(UIImage.FromFile("assets/gallery/pic_" + idx +
".jpg"));

 
AddSubview(view);

                                                }

                                }

 

This is my test code to find out why my App is crashing. What is wrong
with the code above? Without the BackgroundImage, it doesn't crash.

It runs for about a minute before running out of memory.

 

Thanks,

Jon

 

 

Von: [email protected] [mailto:[email protected]] Im Auftrag von
Craig Dunn
Gesendet: 30 June 2011 10:09
An: Jon Hopkins
Cc: [email protected]
Betreff: Re: [MonoTouch] (no subject)

 

CATiledLayer might help

 

Sorry I don't have anything more sophisticated, but there's a basic
example here

http://conceptdev.blogspot.com/2010/09/monotouch-help-catiledlayer-not-q
uite.html

 

 

On Thu, Jun 30, 2011 at 5:04 PM, Jon Hopkins <[email protected]>
wrote:

Hi,

 

Anyone know the best technique for a large paged, scrollable area. I
have tried a UIScrollView with a large contentsize, but I

Am getting memory issues and crashes.

Is there a viewcontroller that can manage preloading and side scrolling.

 

Thanks,

Jon


_______________________________________________
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