T
T
Tommy322017-01-31 07:46:01
Apple Xcode
Tommy32, 2017-01-31 07:46:01

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

[[+comments_count]] answer(s)
T
Tommy32, 2017-02-01
@Tommy32

///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()

A
Anton, 2017-01-31
@sibit11

https://www.google.ru/search?client=safari&rls=en&...
The higher the answer to a question in Google search, the less you want to answer it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question