ProMotion
ProMotion copied to clipboard
Allow for multiple navigation bar items
To accomplish this, I've done the following:
first_button = UIBarButtonItem.alloc.initWithImage(first_image,
style: UIBarButtonItemStylePlain,
target: self,
action: :first_action
)
second_button = UIBarButtonItem.alloc.initWithImage(second_image,
style: UIBarButtonItemStylePlain,
target: self,
action: :second_action
)
self.navigationItem.rightBarButtonItems = [first_button, second_button]
It would be nice to implement something in PM such as:
set_nav_bar_buttons {
right: [
{ image: first_image, action: :first_action },
{ image: second_image, action: :second_action }
],
left: [
{ image: left_image, action: :left_action }
]
}
@markrickert, @silasjmatson, @ryanlntn, thoughts on the above API? Any alternatives?
PM 2.1+.
What if we made nav_bar_buttons
an accessable array? We could do something like:
set_left_nav_bar_button whatever
left_nav_bar_buttons << some_other button
Just an idea, but may be half-baked.
I was tossing around that idea myself. Wouldn't be as consistent with our previous API, though.