【发布时间】:2013-11-30 13:40:51
【问题描述】:
不可见的 ViewContoller (SecondViewController) 显示 UIAlertView,如下所示:
ViewController *viewc = [[ViewController alloc]init];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Fehler" message:@"Message" delegate:viewc.delegate cancelButtonTitle:@"Ok" otherButtonTitles: nil] ;
[alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];
在 ViewController.h 中,委托是这样定义的:
@property (strong, nonatomic) id<UIAlertViewDelegate> delegate;
但是在ViewController.h 中没有调用委托方法。我做错了什么?
【问题讨论】:
-
@Greg 是集成方法
[alertView show] -
是的,我确实没有注意到这一点。您是否刚刚分配了 viewc 并尝试在其上处理 UIAlertViewDelegate?如果你想处理委托,我相信你应该展示 viewc。
标签: ios iphone objective-c delegates uialertview