-
-
Save Parietal/0b25b05bdbc5869a4c2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in viewDidLoad... | |
var tapGestureRecognizer = UITapGestureRecognizer(target: self, action: "showToolbars") | |
tapGestureRecognizer.cancelsTouchesInView = false | |
scrollView.addGestureRecognizer(tapGestureRecognizer) | |
// somewhere else... | |
func showToolbars() { | |
UIView.animateWithDuration(1.0, delay: 0.0, options: UIViewAnimationOptions.CurveEaseOut, animations: { | |
self.toolbar.frame = CGRectMake(0, self.view.frame.size.height-self.toolbar.frame.size.height, self.toolbar.frame.size.width, self.toolbar.frame.size.height) | |
if self.ios7Patches!.verticalSizeClass == UIUserInterfaceSizeClass.Compact { // iPhone Horizontal | |
self.navigationController.navigationBar.frame = CGRectMake(0, 0, self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height) | |
} else { | |
self.navigationController.navigationBar.frame = CGRectMake(0, 20, self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height) | |
} | |
}, completion: {(value: Bool) in}) | |
hideToolbarsTimer?.invalidate() | |
hideToolbarsTimer = NSTimer.scheduledTimerWithTimeInterval(5.0, target: self, selector: "hideToolbars", userInfo: nil, repeats: false) | |
} | |
func hideToolbars() { | |
hideToolbars(nil, delay: nil) | |
} | |
func hideToolbars(duration:NSTimeInterval?, delay:NSTimeInterval?) { | |
var intDelay : NSTimeInterval | |
if var thisDelay = delay { | |
intDelay = thisDelay | |
} else { | |
intDelay = 0.0 | |
} | |
var intDuration : NSTimeInterval | |
if var thisDuration = duration { | |
intDuration = thisDuration | |
} else { | |
intDuration = 1.0 | |
} | |
UIView.animateWithDuration(intDuration, delay: intDelay, options: UIViewAnimationOptions.CurveEaseOut, animations: { | |
self.toolbar.frame = CGRectMake(0, self.view.frame.size.height, self.toolbar.frame.size.width, self.toolbar.frame.size.height) | |
self.navigationController.navigationBar.frame = CGRectMake(0, -(self.navigationController.navigationBar.frame.size.height), self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height) | |
}, completion: {(value: Bool) in}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment