Этот код работал годами. В эти выходные добавили новую версию приложения (OS9 -> 13), и UIPickerView внутри UIPopoverController потерял свой UIToolbar.
Большой скачок, я знаю, но все остальное, что требовало обновления, выбросило предупреждения.
Что изменилось, что остановило работу этого кода?
// Create Picker
UIPickerView* pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 0.0, 800.0, 346.0)];
pickerView.autoresizingMask = (UIViewAutoresizingFlexibleWidth);
pickerView.delegate = self;
pickerView.dataSource = self;
pickerView.showsSelectionIndicator = YES;
pickerView.tag = 1;
self.yourPickerView = pickerView;
UIToolbar* keyboardDoneButtonView = [[UIToolbar alloc] init];
keyboardDoneButtonView.barStyle = UIBarStyleBlack;
keyboardDoneButtonView.translucent = YES;
keyboardDoneButtonView.tintColor = nil;
[keyboardDoneButtonView sizeToFit];
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
flexibleSpace.width = 640.0f;
UIBarButtonItem* doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Select"
style:UIBarButtonItemStylePlain target:self
action:@selector(pickerDoneClicked:)];
UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel"
style:UIBarButtonItemStylePlain target:self
action:@selector(pickerCancelClicked:)];
[keyboardDoneButtonView setItems:[NSArray arrayWithObjects:cancelButton, flexibleSpace, doneButton, nil]];
// * Create popover to house picker and toolbar
UIViewController* popoverContent = [[UIViewController alloc] init];
popoverContent.preferredContentSize = CGSizeMake(800, 346);
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 800, 346)];
popoverView.backgroundColor = [UIColor whiteColor];
[popoverView addSubview:pickerView];
[popoverView addSubview:keyboardDoneButtonView];
popoverContent.view = popoverView;
currentPopoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
[currentPopoverController presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
// Initiate our selected address variable with the first index
if ([arrLocations count]>0) {
theAddress = [arrLocations objectAtIndex:0];
}
// Turn on the boolean to track wether the popup is active
doesContain = 1;