i'm cracking my head on memory issues with my app, the app are working fine except that it will crash once it hit low memory warning and are very very very laggy when using it for 10 to 20 minutes.
EDIT: how to poptoviewcontroller?
introvideo-> welcomeview & tutorialview-> mainviewcontroller-> scannerviewcontoller-> questionview ->(if answer correct -> correctView) else ->wrongView
how do i pop back to mainView controller ?
the below code are to solve adding view controller to the navigationcontroller.viewcontroller stack. As i'm using storyboard pushing from viewcontroller to another view contoller with out poping. the code will pop to the viewcontroller that are already in the viewcontroller stack.
the flow of the of my storyboard as attached:
http://dl.dropbox.com/u/418769/storyboard%20flow.png
intro video -> welcome view & tutorial view (if username !exist) -> main view controller
this is the main file that user will alway go to.
http://dl.dropbox.com/u/418769/scannerViewController.h
http://dl.dropbox.com/u/418769/scannerViewController.m
i'm using a custom segue to pop viewcontrollers, which solved part of the problem.
-(void)perform {
UIViewController *sourceVC = (UIViewController *) self.sourceViewController;
NSInteger index = -1;
NSArray* arr = [[NSArray alloc] initWithArray:sourceVC.navigationController.viewControllers];
for(int i=0 ; i<[arr count] ; i++)
{
if([[arr objectAtIndex:i] isKindOfClass:NSClassFromString(@"mainViewController")])
{
index = i;
}
}
[UIView transitionWithView:sourceVC.navigationController.view duration:0.5
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
[sourceVC.navigationController popToViewController:[arr objectAtIndex:index] animated:NO];
}
completion:^(BOOL completed)
{
}
];
}
however, the app are still eating up the RAM and VRAM.
I really appreciate any friends here to help solving my question, does Strong value caused this problem ?