Reputation: 111
In my app, I go to a webpage which is a keynote file. Users can browse that keynote and follow along on their own device. I allow all rotations, and it rotates fine. To make more room when in landscape, I have it hide the navigation bar on swipe. When I do this in portrait, it hides it and all is fine. When I do it in landscape, I get a crash. All I get in console is Message from debugger: Terminated due to memory issue
. The code is:
- (void) viewDidAppear:(BOOL)animated {
self.navigationController.hidesBarsOnSwipe = YES;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
[super viewDidUnload];
}
-(void)viewWillAppear:(BOOL)animated {
[super viewDidLoad];
self.title = @"Worship Slides";
[worship loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.316apps.com/Fritch/worship.key"] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0]];
}
Upvotes: 0
Views: 210
Reputation: 53121
I'm guessing this is old code you've found somewhere. Not that this will solve your problems but…
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear: animated]; // Add super call
self.navigationController.hidesBarsOnSwipe = YES;
}
// No need for this method if you're not actually overriding it
//- (void)didReceiveMemoryWarning {
// // Releases the view if it doesn't have a superview.
// [super didReceiveMemoryWarning];
//
//}
// viewDidUnload was deprecated in iOS 6
//- (void)viewDidUnload {
// [super viewDidUnload];
//
//}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated]; // User correct super call here
self.title = @"Worship Slides";
[worship loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.316apps.com/Fritch/worship.key"] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0]];
}
Upvotes: 0
Reputation: 1467
You should not be calling [super viewDidLoad] from the viewWillAppear handler. This could be contributing to your problem, since viewDidLoad is for one-time-init stuff.
Upvotes: 2