0
次の実装をアプリ全体で再利用することができます。私はUtility.mクラスに次のコードを格納します。アラートボタンクリックイベントを検出
CustomViewController.m
どのように私はあなたのoneButtonDisplayAlert:withMessage:
メソッドにブロックパラメータを追加します。
+ (UIAlertController *)oneButtonDisplayAlert : (NSString*)title withMessage : (NSString*) message
{
UIAlertController * alert = [UIAlertController
alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* yesButton = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
//Handle your yes please button action here
}];
[alert addAction:yesButton];
return alert;
}
多くの方法があります。代表者/通知。あなたが試したことを示してください。 –