Thanks Craig, I will take a look at that.  But I've tracked down my main
bug

 

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 : UIScrollView

                .....

                Initialise method...

 

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

.....

 

                private void myTimer() {

                                                

                                /*           foreach (UIView subview in
Subviews) {

 
subview.RemoveFromSuperview();

subview.BackgroundColor.Dispose();

 
subview.Dispose();

                                                } */

                                                if (Subviews.Length > 0)
{

                                                                var sv =
Subviews[0];

 
sv.RemoveFromSuperview();

 
sv.BackgroundColor.Dispose();

 
sv.Dispose();

                                                                sv =
null;                              // cannot do this in a foreach loop

                                                }

                //                            GC.Collect();

                                                

                                                trace("svc=" +
Subviews.Length);    // always 0

 

                                                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);

                                                }

                                                trace("added");

                                }

 

This is my test code to find out why my App is crashing. What is wrong
with the code above? Without the BGImage, 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