From 2a5993c54224cedfc078bd3b60160566bbfa8665 Mon Sep 17 00:00:00 2001 From: ninjinkun Date: Fri, 2 May 2014 15:49:19 +0900 Subject: [PATCH] Modified DemoApp. Resume bars when app back to forground from other apps. --- DemoApp/Base.lproj/Main.storyboard | 6 +++--- DemoApp/ViewController.m | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/DemoApp/Base.lproj/Main.storyboard b/DemoApp/Base.lproj/Main.storyboard index 908d078..e86c0f6 100644 --- a/DemoApp/Base.lproj/Main.storyboard +++ b/DemoApp/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -89,4 +89,4 @@ - \ No newline at end of file + diff --git a/DemoApp/ViewController.m b/DemoApp/ViewController.m index b4fecad..ffb034a 100644 --- a/DemoApp/ViewController.m +++ b/DemoApp/ViewController.m @@ -28,6 +28,8 @@ - (void)dealloc // If or when UIScrollView's delegate is referred to with "weak" rather // than "assign", this can and should be removed. self.tableView.delegate = nil; + + [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (void)viewDidLoad @@ -45,6 +47,8 @@ - (void)viewDidLoad _scrollProxy.delegate = self; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetBars) name:UIApplicationWillEnterForegroundNotification object:nil]; // resume bars when back to forground from other apps + if (!IS_RUNNING_IOS7) { // support full screen on iOS 6 self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; @@ -91,6 +95,13 @@ - (void)refreshControlValueChanged:(id)sender }); } +- (void)resetBars +{ + [_scrollProxy reset]; + [self showNavigationBar:NO]; + [self showToolbar:NO]; +} + #pragma mark - #pragma mark UITableViewDataSource