Nav bar button bigger than the nav bar height - ios

Let's have a a picture :
Is there a way to have a Navbar button bigger than the navbar it self, like the "O" button ?
Or If not, what is the best hack if i want to trie to have this renderer ?

I think the best way it make custom viewcontroller which support this logic.
For example you can create custom viewcontroller with method setNavigationBarByType:(YourType)
Then use this viewcontroller as parent viewController

Try with clipSubview = NO for UINavigationBar --> Its UIView property so it should work over UINavigationBar as well but I'm not sure about this
Instead of using UINavigationBar use custom controls like,
UIView as a containerView
--Backround UIImageView
--Back UIButton Custom style
--Right UIButton Custom style
Display this containerView in your RootViewController where you require to put common controls of your application. and the middle part of screen will be populated as per button tap event or screen flow.
Hope this will help you.

Create UILabel configure and set as navigation bar title view.
Added this button as subview to navigation bar title view.

Related

How to make multiple right bar button items stack vertically in navigation bar?

How can I add a UIlabel to the area in green? (it will be within the navigation bar)
I was able to add the logo as a button image in rightBarButtonItem, but I can't google a way to add a label to the nav bar in this specific position.
After reading around I'm thinking maybe I have to create a custom view that would contain the logo and a UILabel, arrange them vertically within that view, and then place that view in rightBarButtonItem?
edit: This is a unique problem from other answers here in that I am looking for how to add a UILabel to an area of the NavigationBar that is outside of the "rightBarButtonItem" area. Using rightBarButtonItem or setting a custom view to appear within rightBarButtonItem does not achieve what I am looking for. I want a UILabel to appear in the NavBar on the right side aligned vertically with the "Today" title.
I ended up figuring out that using a custom header within the collectionView is the way to go (rather than trying to place a UILabel into the navigationBar via a custom UIView into the rightBarButtonItem space). This worked for me because I wanted the title and date to disappear upon scrolling anyway. Basically this mimics the "Today" tab in the iOS App Store, and my solution finally achieved what I was looking for.
Finished result:
The 2 posts that helped me set up the collectionView header and attach the labels are here:
How to add UICollectionView Header
Display Section Header UICollectionReusableView
You can follow this code snippet:
let containerView = UIView()
...
let rightBarButton = UIBarButtonItem(customView: containerView)
navigationItem.rightBarButtonItem = rightBarButton

Ios Swift : Adding or Moving NavigationBar to bottom of the view controller

I want to move the navigation controller bar to the bottom of the view controller. How can i get this done ?
I tried :
self.navigationController!.navigationBar.frame = CGRectMake(
0,
UIScreen.mainScreen().bounds.height - 50,
UIScreen.mainScreen().bounds.width,
50)
This is moving to the bottom but hiding all other controller objects and also back button is not woking.
Sujay U N,
You should not try to move the UINavigationBar provided by the embeded UINavigationController to the bottom of the screen. Trying that will obvisoulsy move all the view's below it causing all the controller objects to hide.
Workaround
Approach 1:
Consider using ToolBar :)
Toolbar is designed to be placed at the bottom of the screen. If you are using xib or storyboard you can pick toolbar from components library and place it on your ViewController's bottom and then apply autoresizing masks or constraints properly :)
Now in order to show the back button make use of UIBarButtonItems. Change the style to custom and provide it arrow image or provide default style as done.
Though now you are all set to go :) You will notice UINavigationBar at the top of your view controller. In order to get rid of it,
select your ViewController, select its TopBar property set it to none :)
Approach 2
Use UINavigationBar.
Specific about using Navigation bar and dont want to use toolbar, well you can do the same thing with UINavigationBar as well.
Drag the UINavigationBar from components library place it at the bottom of the screen. Drag the UIBarButtonItem drop it as leftBarButtonItem, change the barButtonItem image to your back image. ( Same process as UIToolBar just use UINavigationBar instead)
Understand this is not same as the navigation bar provided by the embeded NavigationController. So get rid of NavigationBar at the top of your ViewController same as I explained above here as well
Finally,
In both the cases, draw an IBoutlet from barbutton item and handle poping the viewController programmatically.
Happy coding :)

iOS : subclassing UINavigationBar for custom title view

I've subclassed UINavigationBar, I wanted to have a UIView contains UIImageView + UILabel inside it, I'm able to achieve it by setting titleView property. But, what I want to know is whether its possible to add it inside subclass directly?
Better way add one UIView on Navigationbar and then add any component on that so it is easy to manage those component because if you add component on left button right button and title label it not that much flexible to customise (i.e. if you added any component on titleLabel you can set that component frame only equal or less that title label. but if you add on UIView on Navigation bar then you can customise all components easily)
I hope it will help you.

Achieving iOS 7.1 UINavigationBar blur

I have another UIView under the navigation bar like this.
I want the slight blur of the navigation bar for that UIView too. Currently I have its alpha value reduced but it doesn't give the desired effect as you can see.
How can I get the frosty look of the navigation bar for the UIView as well? I'm on iOS 7.1.
Don't use a UIView - you will never achieve a consistent result with the navigation bar.
Use a UIToolbar and place it below the navigation bar. Set the delegate of the toolbar to your view controller and implement positionForBar: to return UIBarPositionTop or UIBarPositionTopAttached. You can then add all the subviews you have in your view to the toolbar.
you can use UIToolbar, it's the quickest way.
If you want to customize it, you have to use 3rd library like ILTrasparentView, FXBlurView ...

adding Button on UITtabbar and My button must be higher than TabBar (Objective C)

I'm working on UITabBarController. And now i want to add Button in the middle of UITabBar. The problem is my button must be higher than TabBar. In other words half of my button is out of TabBar. Is it possible? if it is possible, how can i do that? Thanks.
You can cover the UITabBarController with a UIView that has buttons. Use the buttons to programmatically select the correct tab. make the UIView have a clear background and be the height of the tallest button on the bar.

Resources