我想在我的UIAlertView中添加复选框视图。 我已经制作了按钮放置的视图:
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250, 50)];
[buttonCheck setImage:[UIImage imageNamed:@"btn_check_off_holo_light.png"] forState:UIControlStateNormal];
[buttonCheck addTarget:self action:@selector(agreementCheck) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:buttonCheck];
然后我打电话给UIAlertview
UIAlertView *alertSeat = [[UIAlertView alloc] initWithTitle:[language stringForKey:@"WARNING_SEAT_TITLE"] message:[NSString stringWithFormat:@"%@\n%@\n\n%@", [language stringForKey:@"WARNING_SEAT_SELECTION"], [language stringForKey:@"WARNING_SEAT_SELECTION2"], [language stringForKey:@"WARNING_SEAT_CONTENT_MESSAGE"]] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alertSeat setValue:view forKey:@"accessoryView"];
[alertSeat show];
这适用于7.0以上的IOS,但在IOS 6.1及以下版本中给出了以下错误:
***由于未捕获的异常终止应用' NSUnknownKeyException',原因:' [setValue:forUndefinedKey:]:this class不是关键附件View的密钥值编码兼容。'
尝试在Google上搜索,但无法找到解决方案。 任何帮助,将不胜感激。感谢