###前提・実現したいこと
FlatUIKitのAlert Viewsを実装したいのですが、
作動させてみるとエラーでアプリが落ちてしまいます。
また、ナビゲーションやテキストフィールドなどの設定はできているためオブジェクトCのライブラリを使う準備は正しくできていると思います。
後、このFUIAlertViewでのaddActionはどう実装すれば良いのが教えてください。
よろしくお願い致します。
###エラーメッセージ
libc++abi.dylib: terminating with uncaught exception of type NSException
###実装したコード
Swift
1 2import UIKit 3import FlatUIKit 4 5class viewContoller:FUIAlertViewDelegate { 6............. 7 8 9@IBAction func pushButton(sender: AnyObject) { 10var alertView = FUIAlertView(title: "a", message: "a", delegate: self, cancelButtonTitle: "a") 11 alertView.titleLabel.textColor = UIColor.cloudsColor() 12 alertView.titleLabel.font = UIFont.boldFlatFontOfSize(16) 13 alertView.messageLabel.textColor = UIColor.cloudsColor() 14 alertView.messageLabel.font = UIFont.flatFontOfSize(14) 15 alertView.backgroundOverlay.backgroundColor = UIColor.cloudsColor().colorWithAlphaComponent(0.8) 16 alertView.alertContainer.backgroundColor = UIColor.midnightBlueColor() 17 alertView.defaultButtonColor = UIColor.cloudsColor() 18 alertView.defaultButtonShadowColor = UIColor.asbestosColor() 19 alertView.defaultButtonFont = UIFont.boldFlatFontOfSize(16) 20 alertView.defaultButtonTitleColor = UIColor.asbestosColor() 21 alertView.show() 22}
###こう書きなおしてみました
Swift
1import UIKit 2import FlatUIKit 3 4class ViewController: UIViewController,FUIAlertViewDelegate { 5 6......... 7 8@IBAction func pushAction(sender: UIBarButtonItem) { 9 let alertView = FUIAlertView() 10 alertView.title = "Title" 11 alertView.delegate = self 12 alertView.message = "Message" 13 alertView.addButtonWithTitle("Cancel") 14 alertView.hasCancelButton = true 15 // キャンセルボタンを押下時のイベント(ブロックの中が呼ばれます) 16 alertView.onCancelAction = { 17 print("Push Cancel!") 18 } 19 // 更にボタンを追加する場合は以下 20 alertView.addButtonWithTitle("OK") 21 alertView.onOkAction = { 22 print("Push OK!") 23 } 24 alertView.show() 25 print("push")//ここは反応する 26 } 27

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/05/29 04:17
2016/05/29 04:58
2016/05/29 06:32