From fe8e721fbeeaa802b0a3c3092d6d3e6d758cf583 Mon Sep 17 00:00:00 2001 From: Grant Paul Date: Wed, 2 Feb 2011 00:11:55 -0800 Subject: Added session persistence; moved -init to -loadView, -viewDidLoad, etc; added releasing of views in low-memory situations; style changes. --- UICaboodle/RVPage.h | 5 ++++- UICaboodle/RVPage.mm | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'UICaboodle') diff --git a/UICaboodle/RVPage.h b/UICaboodle/RVPage.h index 1f39428..68ffb39 100644 --- a/UICaboodle/RVPage.h +++ b/UICaboodle/RVPage.h @@ -4,8 +4,11 @@ @interface CYViewController : UIViewController { id delegate_; + BOOL loaded_; } -- (void)setDelegate:(id)delegate; +- (NSURL *)navigationURL; +- (void) setDelegate:(id)delegate; - (void) reloadData; +- (void) releaseSubviews; @end diff --git a/UICaboodle/RVPage.mm b/UICaboodle/RVPage.mm index 81c8739..d3de6d3 100644 --- a/UICaboodle/RVPage.mm +++ b/UICaboodle/RVPage.mm @@ -6,12 +6,39 @@ #import "RVBook.h" @implementation CYViewController + - (void) setDelegate:(id)delegate { delegate_ = delegate; } + +- (void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + if (!loaded_) + [self reloadData]; +} + +- (void) releaseSubviews { + // Do nothing. +} + +- (void) setView:(UIView *)view { + if (view == nil) + [self releaseSubviews]; + + [super setView:view]; +} + - (void) reloadData { + loaded_ = YES; } + +- (NSURL *) navigationURL { + return nil; +} + - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad || orientation == UIInterfaceOrientationPortrait); } + @end -- cgit v1.2.3