Created
July 22, 2015 08:34
-
-
Save cocoaNib/774a1eef1e287733490a to your computer and use it in GitHub Desktop.
Toggle StatusBar Example
This file contains 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
// | |
// ToggleStatusBarViewController.swift | |
// UIKitExamples | |
// | |
// Created by Renate Wünschl on 22.07.15. | |
// Copyright (c) 2015 cocoanib. All rights reserved. | |
// | |
import UIKit | |
class ToggleStatusBarViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
override func prefersStatusBarHidden() -> Bool { | |
return !UIApplication.sharedApplication().statusBarHidden | |
} | |
override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation { | |
return UIStatusBarAnimation.Slide | |
} | |
@IBAction func toggleStatusBar(sender: UIButton) { | |
UIView.animateWithDuration(0.5, | |
animations: { | |
self.setNeedsStatusBarAppearanceUpdate() | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment