func showAlert(Msg: NSString, viewController : UIViewController) -> Void {
let floatVersion = (UIDevice.currentDevice().systemVersion as NSString).floatValue
if (floatVersion >= 8.0){
println("showAlert_swift")
let alert = UIAlertController(title:NSLocalizedString("AppTitle", comment: "Common"), message: Msg, preferredStyle: UIAlertControllerStyle.Alert)
let okButton = UIAlertAction(title:NSLocalizedString("OK", comment: "Common"), style: UIAlertActionStyle.Default) { (okSelected) -> Void in
println("Ok Selected")
}
alert.addAction(okButton)
viewController.presentViewController(alert, animated: true, completion: nil)
}else{
var alert = UIAlertView();
alert.title = NSLocalizedString("AppTitle", comment: "Common")
alert.delegate = self
alert.message = Msg
alert.addButtonWithTitle(NSLocalizedString("OK", comment: "Common"))
alert.cancelButtonIndex = 0;
alert.show()
}
}
'SWIFT' 카테고리의 다른 글
스위프트 ARC와 순환참조와 클로저 (0) | 2017.09.07 |
---|---|
guard 문 (0) | 2016.04.07 |
Swift Singletons 구현 방법 (0) | 2014.12.09 |
Apple Swift Programming Language for KOREAN - 배포중 (0) | 2014.06.12 |