I want to add checkbox view to my UIAlertView. I have made the view in which the button will be placed on :
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];
Then I call the 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];
This works well on IOS above 7.0 and above, but gives me following error on IOS 6.1 and below :
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key accessoryView.'
Have tried searching in Google, but can't find solution. Any help would be appreciated. Thanks
The iOS version before 6 is not the same with the 7. you can see this page custom alter view
the best solution is use the lib named custom alter
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.