Skip to content

Commit

Permalink
Merge pull request #18 from ninjinkun/resume-bars-back-to-forground
Browse files Browse the repository at this point in the history
Resume bars when app backs to foreground
  • Loading branch information
ninjinkun committed May 9, 2014
2 parents 7da751f + 2a5993c commit ce6c113
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions DemoApp/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="pH6-8N-gIx">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="pH6-8N-gIx">
<dependencies>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
<scenes>
<!--View Controller - UITableView-->
Expand Down Expand Up @@ -89,4 +89,4 @@
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
</document>
11 changes: 11 additions & 0 deletions DemoApp/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -91,6 +95,13 @@ - (void)refreshControlValueChanged:(id)sender
});
}

- (void)resetBars
{
[_scrollProxy reset];
[self showNavigationBar:NO];
[self showToolbar:NO];
}

#pragma mark -
#pragma mark UITableViewDataSource

Expand Down

0 comments on commit ce6c113

Please sign in to comment.