1

I want to add rightBarButtonItem directly to the position of second place because I already have slider menu button on the right side of navigation bar(which is placed by third party framework and I don't have control over it). The following is the screenshot for the same with black area where I want second button for notifications.

enter image description here

Following is the code using which add it to top of slider menu button:-

let backButton = UIButton(type: UIButton.ButtonType.custom)
backButton.setImage(UIImage(named: "menulist"), for: UIControl.State())
backButton.frame=CGRect(x: 0, y: 0, width: 25, height: 25)
let rightbarButton = UIBarButtonItem(customView: backButton)
self.navigationItem.rightBarButtonItem = rightbarButton

Slider menu is a third party framework so I don't have any idea how to achieve it.

Please help and suggest some workaround.

Priyanka
  • 207
  • 2
  • 10

1 Answers1

0

You can append your new item like:

navigationItem.rightBarButtonItems?.append(newButton)
Omer Faruk Ozturk
  • 1,722
  • 13
  • 25
  • Thanks for your reply but I want bar button to be placed directly on secord position because slider menu button is placed by third party framework. so I don't have control over it. Is there any way of setting bar button position? – Priyanka Jul 13 '20 at 16:48
  • 1
    So you can append current items `navigationItem.rightBarButtonItems?.append(newButton)` does it solve your question? – Omer Faruk Ozturk Jul 13 '20 at 16:53