E
E
Eugen Typalchuk2014-03-05 21:15:22
iOS
Eugen Typalchuk, 2014-03-05 21:15:22

How to place UISegmentedControl in UINavigationBar?

Good day. I really need help.
Faced the following problem:
you need to place a UISegmentedControl in a UINavigationBar as in the picture
b687ed48a8464a99ad7fcdb04efa1f8d.png
. I have already tried several options:
1. placed the segmented control in the title of the navigation bar, and the title itself was indicated in the prompt. The result is not the same.
2. I was told that in the picture this is not a standard UINavigationBar, but a UIView.
At this stage, I'm trying to implement using the 2nd option, but I already see that there will be a lot of problems.
Perhaps someone faced such a problem? Perhaps there is a ready solution?
I will be very grateful for advice.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
E
Eugen Typalchuk, 2014-03-06
@tipalchuk

An example of what happened .
Example
You need to configure a little more, but the essence is clear.

I
IURIA, 2014-03-06
@GxocT

1. Create a CustomNavigationBar class: UINavigationBar .
2. Initialize UInavigationController using your CustomNavigationBar . [[UInavigationController alloc] initWithNavigationBarClass:[CustomNavigationBar class] toolbarClass:nil];
3. Well, then, CustomNavigationBar is at your complete disposal. Add at least UISegmentedControl to it , at least your own implementation of such functionality.
stackoverflow.com/questions/6672229/how-to-subclas...

Z
z0rgoyok, 2014-03-06
@z0rgoyok

may help
stackoverflow.com/questions/15587978/uisegmentedco...
stackoverflow.com/questions/18813563/add-segmented...

A
Alexey Storozhev, 2014-03-06
@storoj

I think this is really not a navigation bar, it’s not clear what height it has here

E
Eugen Typalchuk, 2014-03-06
@tipalchuk

All the same, I managed to achieve the desired result in the following way:
1. Under the navigation bar, I placed a uiview with a segmented control
2. Removed the bottom border from the navigation bar
3. Added a bottom border from the UIView 4. Plus
manipulations with constraints for the view controller
I can give a link to github

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question