zhuorantan / LocationPicker

A ready for use and fully customizable location picker for your app
MIT License
400 stars 79 forks source link

Customize BarButtonItems with addBarButtons func #23

Closed guillotemanija closed 7 years ago

guillotemanija commented 7 years ago

Hi,

I'm trying and failing to customize the "cancel" and "done" bar button items's text.

I have tried doing this but it does not work.

locationPicker.barButtonItems?.doneButtonItem.title = "newDone"

I also tried this with no luck:

let doneButton = locationPicker.barButtonItems?.doneButtonItem
doneButton?.title = "newDone"
let cancelButton = locationPicker.barButtonItems?.cancelButtonItem
cancelButton?.title = "newCancel"
locationPicker.addBarButtons(doneButtonItem: doneButton, cancelButtonItem: cancelButton, doneButtonOrientation: .right)

Could you provide an example on how to do it the right way? Thank you!

zhuorantan commented 7 years ago

You need to create new instances of UIBarButtonItem, and pass them to addBarButtons