UIAlertViewDelegate
私はこのようにそのメソッドを呼び出すことを宣言しました
-(IBAction)hidding{
[self removeFromParentViewController];
UIAlertView *alert1= [[UIAlertView alloc] initWithTitle:@"Logged in"
message:[NSString stringWithFormat:@"Welcomes you"]
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert1 show];
}
- (void)alertViewUIAlertView *)actionSheet clickedButtonAtIndexNSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
NSLog(@"clicking");
if (buttonIndex == 0)
{
NSLog(@"ok");
}
else
{
NSLog(@"cancel");
}
}
どのボタンがクリックされたかを確認し、何らかのアクションを実行します。ただし、UIAlertView
が表示され、[OK]オプションをクリックするとクラッシュし、* "プログラム受信信号:" EXC_BAD_ACCESS"*のエラーが表示されます。
具体的には、これUIAlertView
を1stclassで宣言し、2ndclassでいくつかのパラメーターを比較しています。2ndclassから、これを持つ1stclassメソッドを呼び出していますUIAlertView
。