Agregar botones a la barra de navegación ios

I am trying to add two right buttons to the navigation bar. I tried adding using following ways but I get SIGABRT

  1. self.navigationController.navigationBar.items = navItemsArray;
  2. self.navigationItem.rightBarButtonItems = navItemsArray;

navItemsArray has two buttons of type UIBarButtonItem.

Can anyone help with this? I can't figure out what is wrong.

preguntado el 08 de noviembre de 11 a las 15:11

This stackoverflow thread gives some good answers: stackoverflow.com/questions/1803609/… -

3 Respuestas

self.navigationItem.rightBarButtonItems = navItemsArray;

works only in iOS 5.

Respondido 17 Abr '12, 18:04

which solution would you use for iOS4? - Koolala

do you have callbacks for the buttons? Did you "wire up" the buttons by option-clicking them and dragging them to something?

You need to have the buttons connected to an IBAction.

respondido 08 nov., 11:19

You cannot add directly two UIBarButtonItem in UINavigationBar. Pero usa UIToolBar to have same effect as of Navigation Bar. You can add any controls in UIToolBar Such as switch, segmentedControl etc.

For more help on Code please refer the previous post Link1 y Link2

contestado el 23 de mayo de 17 a las 13:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.