Answer the question
In order to leave comments, you need to log in
How to give your name to done and cancel button in ActionSheetPiker on swift3?
The guide hub gives instructions on how to do this, but not on swift, help me how to write correctly on swift3?
https://github.com/skywinder/ActionSheetPicker-3.0...
here is the actual code for changing the button name. There is also a link with the addition of an icon.
ActionSheetStringPicker *picker = [[ActionSheetStringPicker alloc] initWithTitle:@"Select a Block" rows:colors initialSelection:0 doneBlock:done cancelBlock:cancel origin:sender];
[picker setDoneButton:[[UIBarButtonItem alloc] initWithTitle:@"My Text" style:UIBarButtonItemStylePlain target:nil action:nil]];
[picker showActionSheetPicker];
Answer the question
In order to leave comments, you need to log in
///Our buttons
let done = UIBarButtonItem()
done.title = "Done"
let cancel = UIBarButtonItem()
cancel.title = "Cancel"
///Picker
let picker = ActionSheetMultipleStringPicker.init(title: "Choose a department", rows : [our array], initialSelection: [0], doneBlock:
{
picker, indexes, values in
print("values = \(values)")
print("indexes = \(indexes)")
print("picker = \( picker)")
/// Action on done
return
}, cancel:
////Action on cancel
{
ActionMultipleStringCancelBlock in
return
}, origin: sender)
// Assign buttons and open the
picker picker?.setDoneButton(done)
picker?.setCancelButton(cancel)
picker?.show()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question