Thanks Pete for the email,

The reason for trying this was because something is falling out of scope and 
being GC'd.

in all my classes the VC that are being called are declared at the top of the 
class and not at method level.

Here is some example code that I have narrowed down the issue.

private void backButton_Clicked(object sender, EventArgs e) {
        // create a VC class;
        revise = new ReviseVCiPhone();
                        
        // works but looks wrong as you are going backwards but the animation 
is forwards.
        NavigationController.PushViewController(revise, true);
                        
        // works but no animation
        //NavigationController.PushViewController(revise, false);
                        
        // this fails with GC issues as soon as you try to come back to this VC
        //NavigationController.PopToViewController(revise, true);
                        
        // this fails with GC issues eventually.
        //NavigationController.PopToRootViewController(true);
}

in my appDelegate class

navigationRoots = new UINavigationController [5] {
        new UINavigationController (mainvc) {
                TabBarItem = new UITabBarItem ("Infomation", UIImage.FromBundle 
("Images/Toolbar/icon_information.png"), 0),
        } ,
        new UINavigationController (revise) {
                TabBarItem = new UITabBarItem ("Revise", UIImage.FromBundle 
("Images/Toolbar/icon_book.png"), 1)
        } ,

------ snipped


thanks

Alex



On 12 Jun 2012, at 20:41, Pete Macko wrote:

> I usually don't hold references to VCs pushed onto the nav controller - just 
> let them go out of scope when they're popped off. Recreate them every time 
> you need to push one onto the stack. 
> 
> 
> On Jun 12, 2012, at 3:35 PM, Alex White wrote:
> 
>> Hi,
>> 
>> I have a small application that goes several levels deep into 
>> tableviewcontrollers, navigating down the tree works fine then back up works 
>> fine, but the second time down the tree I hit errors where objects have been 
>> GC'd.
>> 
>> It is advisable to create a variable at the appdelegate level for each of 
>> the tableviewcontrollers so they don't go out of scope or is there something 
>> I am missing, Creating the objects at a local level means they are getting 
>> GC'd very quickly.
>> 
>> Thanks
>> 
>> Alex
>> _______________________________________________
>> 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