jsetting32
jsetting32

Reputation: 1632

Custom UIBarButtonItem/UISegmentedControl for UINavigationController

Currently I would like to make my UINavigationController have the look and feel like facebook's main view.

enter image description here

I was thinking about using a UIsegmentedControl which would have a transparent background with an image inputted into the button's view.

Another idea was creating custom buttons with their background image as an image.

If anyone has any ideas on how this is done or an example project I can refer to, please REFER me!!! Haha.

Thank you stackoverflow!!!

Upvotes: 0

Views: 226

Answers (1)

Felix Müller
Felix Müller

Reputation: 71

in this case i would just use standard UIBarButtonItems for the left and right ones. The center would then be a custom view with 3 buttons inside. UINavigationItem has a property called 'titleView'.

So in some appropriate controller just do s.th. like:

self.navigationItem.titleView = myCustomViewWithThreeButtonsAsSubviews;
self.navigationItem.rightBarButtonItem = myLeftUIBarButtonItem;
self.navigationItem.leftBarButtonItem = myRightUIBarButtonItem;

setting the styles of the barButtontem to UIBarButtonItemStylePlain and providing images will do the job easily.

Upvotes: 1

Related Questions