Created
September 15, 2014 12:00
-
-
Save aaronabentheuer/d6b167ca796a6a938f98 to your computer and use it in GitHub Desktop.
Screens are Rounded Rectangles.
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
// AppDelegate.swift | |
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
var activeCornerRadius : Int = 6 | |
var incativeCornerRadius : Int = 0 | |
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { | |
window!.clipsToBounds = true | |
var animation : CABasicAnimation = CABasicAnimation(keyPath: "cornerRadius") | |
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) | |
animation.fromValue = activeCornerRadius | |
animation.toValue = 6 | |
animation.duration = 0.15 | |
window!.layer.cornerRadius = 6 | |
window!.layer.addAnimation(animation, forKey: "cornerRadius") | |
return true | |
} | |
func applicationWillResignActive(application: UIApplication!) { | |
var animation : CABasicAnimation = CABasicAnimation(keyPath: "cornerRadius") | |
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) | |
animation.fromValue = 6 | |
animation.toValue = 0 | |
animation.duration = 0.15 | |
window!.layer.cornerRadius = 0 | |
window!.layer.addAnimation(animation, forKey: "cornerRadius") | |
} | |
func applicationDidBecomeActive(application: UIApplication!) { | |
var animation : CABasicAnimation = CABasicAnimation(keyPath: "cornerRadius") | |
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) | |
animation.fromValue = 0 | |
animation.toValue = 6 | |
animation.duration = 0.15 | |
window!.layer.cornerRadius = 6 | |
window!.layer.addAnimation(animation, forKey: "cornerRadius") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Flawless!