当以这种方式按下 buttonCancel 时,我试图调用一个方法:
+ (DejalActivityView *)activityViewForView:(UIView *)addToView withLabel:(NSString *)labelText width:(NSUInteger)aLabelWidth;
{
// Immediately remove any existing activity view:
if (dejalActivityView)
[self removeView];
// Remember the new view (so this is a singleton):
dejalActivityView = [[self alloc] initForView:addToView withLabel:labelText width:aLabelWidth];
buttonCancel = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[buttonCancel addTarget:self
action:@selector(callCancelAlert:)
forControlEvents:UIControlEventTouchDown];
[buttonCancel setTitle:@"Cancel upload" forState:UIControlStateNormal];
buttonCancel.frame = CGRectMake(250, 560, 300, 40);
[addToView addSubview:buttonCancel];
[buttonCancel setImage:[UIImage imageNamed:@"socialize-navbar-bg.png"] forState:UIControlStateNormal];
return dejalActivityView;
}
和方法
-(IBAction)callCancelAlert:(id)sender{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"Announcement"
message: @"It turns out that you are playing Addicus!"
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
//[alert release];
}
我收到此错误:
'NSInvalidArgumentException'的,原因是: '+ [DejalBezelActivityView callCancelAlert:]:无法识别的选择发送到类0x3184e4' *第一掷调用堆栈:(0x327862a3 0x3a61f97f 0x32789ca3 0x32788531 0x326dff68 0x346790c5 0x34679077 0x34679055 0x3467890b 0x3467859b 0x345a1523 0x3458e801 0x3458e11b 0x362805a3 0x362801d3 0x3275b173 0x3275b117 0x32759f99 0x326ccebd 0x326ccd49 0x3627f2eb 0x345e2301 0x39445 0x3aa56b20) libc++abi.dylib: 终止调用抛出异常
应用程序崩溃。