From a3af60a2275335490b4b6ac369c46f251f15f268 Mon Sep 17 00:00:00 2001 From: Cem Olcay Date: Thu, 8 Jan 2015 10:44:15 +0200 Subject: [PATCH] Orientation added ScreenWidth & ScreenHeight updated with orientation organized code --- .../UserInterfaceState.xcuserstate | Bin 28084 -> 30164 bytes CEMKit-Swift/CEMKit.swift | 169 ++++++++++-------- 2 files changed, 96 insertions(+), 73 deletions(-) diff --git a/CEMKit-Swift.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/UserInterfaceState.xcuserstate b/CEMKit-Swift.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/UserInterfaceState.xcuserstate index 161f472fccf0e664c7fcdb2b2c73f43eb44632e3..28069127a7a5b37ad889af79889af59601aee6d7 100644 GIT binary patch delta 8544 zcmeHMXLwUbv)*!4ECDv%blcbztJo@*EZGt!rn^vVOtqw=Vp)>G!3_vSds0aFNFe0U zyNxNKhK~?JAoP~ddkq~z4G=;L?XE1FzJb-~~P~6bu7Jpcsq*w!B=1+ zm;}BClfhIl4a@?SU@7<(tOTpTzrk9t1#AV|z;>_$>;${OZm0*}ID@HjjHPr_61G&~Rgf{)=7 z_!K^a&*9(j1$+r#!Plq(YKR)4#wZ*$K}}IJ)Eu=yF(?ihkP)SzE~qQ&hSE_ll#TkL zL1-|tAt&;nA!ryXMWfJY^fCGbeT62XN$6`d1ugcYC1@%77A-@|(F(K@twNj77PJ*@ zL)+0_bPydyC(&7S4qZf-&^2@u-9nGi6Z8~4L(j1Q3$X}`aR?5@VYne~fm`BMI08rF z_Ba;HunMcO4ku$1{s8yDX*eBcCX&eEDX!InITLmQ^pKu{0w0@W<2vRW&*=AQ<$mDG`Rje?HvlhkOibw(2_#%VZY3*jzvZ6$O=#hvimt*d2DGxNf?dr z;J_uIEHJTB(z+ZBC((4`xou)Xg4(0O82*qbJase}3$h1iW_9v7N<4)_*`kp(+5~(C zoU%@`GpL8T2kW|vC5*!4FsOAyU znRKC=U8^+bB%K47fqW4-4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/CEMKit-Swift/CEMKit.swift @@ -599,6 +599,101 @@ extension UIImage { +// MARK - Globals + + + +var Orientation: UIInterfaceOrientation { + get { + return UIApplication.sharedApplication().statusBarOrientation + } +} + +var ScreenWidth: CGFloat { + get { + if UIInterfaceOrientationIsPortrait(Orientation) { + return UIScreen.mainScreen().bounds.size.width + } else { + return UIScreen.mainScreen().bounds.size.height + } + } +} + +var ScreenHeight: CGFloat { + get { + if UIInterfaceOrientationIsPortrait(Orientation) { + return UIScreen.mainScreen().bounds.size.height + } else { + return UIScreen.mainScreen().bounds.size.width + } + } +} + +var StatusBarHeight: CGFloat { + get { + return UIApplication.sharedApplication().statusBarFrame.height + } +} + + + +// MARK: - UIAlertController + +func alert (title: String, + message: String, + cancelAction: ((UIAlertAction!)->Void)? = nil, + okAction: ((UIAlertAction!)->Void)? = nil) -> UIAlertController { + let a = UIAlertController (title: title, message: message, preferredStyle: .Alert) + + if let ok = okAction { + a.addAction(UIAlertAction(title: "OK", style: .Default, handler: ok)) + a.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: cancelAction)) + } else { + a.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: cancelAction)) + } + + return a +} + + + +// MARK: - UIBarButtonItem + +func barButtonItem (imageName: String, + action: (AnyObject)->()) -> UIBarButtonItem { + let button = BlockButton (frame: CGRect(x: 0, y: 0, width: 20, height: 20)) + button.setImage(UIImage(named: imageName), forState: .Normal) + button.actionBlock = action + + return UIBarButtonItem (customView: button) +} + +func barButtonItem (title: String, + color: UIColor, + action: (AnyObject)->()) -> UIBarButtonItem { + let button = BlockButton (frame: CGRect(x: 0, y: 0, width: 20, height: 20)) + button.setTitle(title, forState: .Normal) + button.setTitleColor(color, forState: .Normal) + button.actionBlock = action + button.sizeToFit() + + return UIBarButtonItem (customView: button) +} + + + +// MARK: - CGSize + +func + (left: CGSize, right: CGSize) -> CGSize { + return CGSize (width: left.width + right.width, height: left.height + right.height) +} + +func - (left: CGSize, right: CGSize) -> CGSize { + return CGSize (width: left.width - right.width, height: left.width - right.width) +} + + + // MARK: - CGPoint func + (left: CGPoint, right: CGPoint) -> CGPoint { @@ -641,39 +736,8 @@ extension CGPoint: StringLiteralConvertible { -// MARK: - CGSize - -func + (left: CGSize, right: CGSize) -> CGSize { - return CGSize (width: left.width + right.width, height: left.height + right.height) -} - -func - (left: CGSize, right: CGSize) -> CGSize { - return CGSize (width: left.width - right.width, height: left.width - right.width) -} - - - // MARK: - CGFloat -var ScreenWidth: CGFloat { - get { - return UIScreen.mainScreen().bounds.size.width - } -} - -var ScreenHeight: CGFloat { - get { - return UIScreen.mainScreen().bounds.size.height - } -} - -var StatusBarHeight: CGFloat { - get { - return UIApplication.sharedApplication().statusBarFrame.height - } -} - - func degreesToRadians (angle: CGFloat) -> CGFloat { return (CGFloat (M_PI) * angle) / 180.0 } @@ -694,49 +758,8 @@ func convertNormalizedValue (value: CGFloat, -// MARK: - UIAlertController - -func alert (title: String, - message: String, - cancelAction: ((UIAlertAction!)->Void)? = nil, - okAction: ((UIAlertAction!)->Void)? = nil) -> UIAlertController { - let a = UIAlertController (title: title, message: message, preferredStyle: .Alert) - - if let ok = okAction { - a.addAction(UIAlertAction(title: "OK", style: .Default, handler: ok)) - a.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: cancelAction)) - } else { - a.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: cancelAction)) - } - - return a -} - - - -// MARK: - UIBarButtonItem - -func barButtonItem (imageName: String, - action: (AnyObject)->()) -> UIBarButtonItem { - let button = BlockButton (frame: CGRect(x: 0, y: 0, width: 20, height: 20)) - button.setImage(UIImage(named: imageName), forState: .Normal) - button.actionBlock = action - - return UIBarButtonItem (customView: button) -} - -func barButtonItem (title: String, - color: UIColor, - action: (AnyObject)->()) -> UIBarButtonItem { - let button = BlockButton (frame: CGRect(x: 0, y: 0, width: 20, height: 20)) - button.setTitle(title, forState: .Normal) - button.setTitleColor(color, forState: .Normal) - button.actionBlock = action - button.sizeToFit() - - return UIBarButtonItem (customView: button) -} +// MARK: - Block Classes // MARK: - BlockButton