ProMotion icon indicating copy to clipboard operation
ProMotion copied to clipboard

Allow for multiple navigation bar items

Open forrestgrant opened this issue 10 years ago • 3 comments

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 }
  ]
}

forrestgrant avatar Apr 01 '14 00:04 forrestgrant

@markrickert, @silasjmatson, @ryanlntn, thoughts on the above API? Any alternatives?

PM 2.1+.

jamonholmgren avatar Aug 03 '14 00:08 jamonholmgren

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.

markrickert avatar Aug 03 '14 01:08 markrickert

I was tossing around that idea myself. Wouldn't be as consistent with our previous API, though.

jamonholmgren avatar Aug 03 '14 01:08 jamonholmgren