How to add a done button over a selection?

I want to display the selection view and the button made above the collector view.

I have a custom shortcut that will be the first responder. Therefore, when he becomes the first responder, I show the selection view as an input view for my label. Now I want a button to be made on the selection panel to reject the selection view. I played with the inputAccesoryView property of UIPickerView , but it didn’t work. inputAccessoryView is possible with UITextView , not sure about UIPickerView . Here is a link to how this can be done using a UITextView

UITextView with Finish and Return button?

Whether any organ tried it, if someone knows how to do this for the collector, answer.

Thanks to everyone in advance!

+6
source share
2 answers

Add a selection view to the action sheet. First of all, make sure that youre view controller impliments UIPickerViewDelegate and UIActionSheetDelegate.

Then add this method and call it when you want to show your selector.

- (void)showPicker { UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Pick Value" delegate:self cancelButtonTitle:@"Done" destructiveButtonTitle:nil otherButtonTitles:nil]; UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,180,0,0)]; pickerView.delegate = self; pickerView.dataSource = self; pickerView.showsSelectionIndicator = YES; [menu addSubview:pickerView]; [menu showInView:self.view.superview]; //Change the height value in your CGRect to change the size of the actinsheet [menu setBounds:CGRectMake(0,0,320, 615)]; [pickerView release]; [menu release]; } 
+3
source

I think you can try to put the collector inside the view using the "Finish" button and present this view

+1
source

Source: https://habr.com/ru/post/885479/


All Articles