Putting a UIView between UINavigationBar and status bar in order to show custom ads - ios

So I'm struggling with a task I assumed would be easy. I'd like to place a UIView to show ads between the UINavigationBar and the top of the window like thus:
It seems like I have two options:
Option (1)
Somehow programmatically push the UINavigationBar downwards and then programmatically insert the UIView above the navigation bar and flush with the bottom of the status bar:
Option (2)
Dragging a "custom" UINavigationBar onto the main view then placing a UIView above the custom navigation bar:
In both options, I'm using a navigation controller for push transitions. In the second option, though, I hide the inbuilt navigation bar since I'm using the custom one.
I've tried both options hitting a brick wall in each. I may edit this question later to go into detail where I've got stuck.............
...........but this should be straightforward!
What's the stock-standard way of putting a UIView between the navigation bar and the status bar? Or, in other words, how do apps that show custom ads (non-iAds) up the top of the app actually show them?
I fear/hope that the solution is blindingly obvious and I'm just not choosing my google search terms wisely.

Related

IOS Custom View or Navigation Bar Controller

I am new to IOS Swift development. I have a navigation bar design which includes, increasing the height (thus increased text size with custom colors), custom UIButton for closing (instead of the usual back button)
and title at the left side (instead of center)
Basically a lot of customization to do. My question is, is it okay to do a custom UIView to act as a navigation bar or should I push through with a NavigationController and just customize it via code?
Thank you.
First of all the navigation bar offer the push navigation through different view controllers in a smarter way, it stacking all the view controllers pushed and it offers some useful features; for example pushing another view controller from storyboard you don't have the need to set the back button and you can come back to the main controller in a simple way.
You can set a custom image for left/right button, set custom fonts and also change the height without big problems; I suggest to keep the navigation bar and evaluate, you should discover in a short time if a nav bar is enough for your needs.

Apple News app scrolling buttons in UINavigationBar

How to implement such a navigation bar? I am aware of the title view but not aware of any subtitle view.
One way I can think of is setting UINavigationBar shadow image to nil and place collection view below the navigation bar. But that won't give me translucency of Navigation bar.
Is there a native way (which may have been introduced in iOS9) of doing so?
I think you'll have to make custom view and will have to use it as navigation bar. Hide the default navigation bar and use your custom view.
I wanted to make the nav.bar as shown in picture with the functionality like tab bar and i've made custom view for that purpose.
You can use a library like PageMenu or PagingMenuController to do this easily.

Dual TabBars in StoryBoard IOS

I've seen that there isn't any possibility of adding a custom tab bar in TabBarController in StoryBoard of IOS. However a single tabBar can contains multiple buttons. But I want to design two tab bars (first one on top and second one on bottom of storyboard) and the content I want to see in the middle of both tabBars. How can I design my custom tabBars using storyboard?
I'm currently designed in xib but I want to get rid of the xib and have to design an autolayout tab bars on storyboard and to avoid remove sub views again and again when each button is called.
Is it possible to design dual tabbars in storyboard?
You can't have 2 tab bar controllers at the same time. The tab bar controller won't allow it, and Apple would very likely reject your app if you created that look yourself. It sounds like a really bad user interface, frankly.
That said, if you want to create an UI with a normal tab bar on the bottom of the window and another thing that looks and acts like a tab bar at the top, you could create a custom parent view controller class and implement your "top tab bar" look yourself, then use that custom view controller as one of the tabs in your tab bar controller. However, I'd bet money that Apple would reject such a thing as a violation of the HIG (Human Interface Guidelines).

iOS. Navigation controller toolbar - customize example

I'm newbie with Xcode, I'm learning it and trying to make my app.
Now I would like to put Navigation Bar func at the bottom of the screen with some customize.
I turn on "Shows Toolbar" at Navigation Controller and put my button there, but I cannot customize it.
Everything that I found about customizing Navigation Bar at the top of the screen or about customizing TabBar when people are talking about bottom of the screen.
Please, can you give me a code examples to build something like this at the bottom of the screen:
https://dl.dropboxusercontent.com/u/1338320/nav.png
Thanks in advance!
I'm not sure what you are trying to customize (button or bar) but when there is a bar at the bottom of the screen that is not a tab bar it is a tool bar not a navigation bar. The two are related but they each have their own class. Tool bars use UIToolBar not UINavigationBar. The tool bar is independent of the navigation controller and the two work together well. For any views that don't want a tool bar just set it to hidden in -viewDidAppear: (you will need to un hide it in views that use it).
dimimpou is right. You can accomplish this by using a UITabBarViewController and one UIBarButtonItem for "ADD ONE" and "MY STATS".
If you get lost in references(I sometimes get lost too), I may provide a simple example.
Note that if the interface provided by UIKit doesn't meet your need you can:
Use category over UITabBar or UITabBarItem.
If 1. doesn't work sadly you'll have create your own view controller which is simulate UITabBarViewController(requires some time, but it's worth)
Edit:
You can use a UINavigationController inside a UITabBarViewController.
You can easily do this. The way I understand it, you want this "Toolbar" to show from a button in the navigation bar. Just put a tab bar with what you need and make it show when the user presses the button on the navigation bar. on this buttons action put this code: self.tabBar.hidden = NO; and on the storyboard uncheck the bar visibility option. Hope it helps!

iOS Navigation Bar VS UIToolBar

According to Apple's "Human Interface Guidelines" - Navigation bars should only have one other button (apart from the standard back button)
All this is fine, but there are several apps which have numerous buttons on the top Navigation bar, such as the Facebook app (Image)
My question / discussion arises from here. . .
1) Would apple accept the use of a UIToolBar in place of a Navigation bar (with a custom "back" button", which would act as a replacement for the Navigation Bar:
2) Is this how Facebook would have achieved their top bar?
3) IF I could use a toolbar instead of a Navigation Bar, i would have a small space at the top where the toolbar would overlap the "status bar" - how should i overcome this issue? -
- would placing a A UIView, in that position with an embedded Toolbar be the correct solution to this issue?
All your help / comments / guides are very much appreciated
You don't have to show the navigation bar, it can be hidden (see setNavigationBarHidden:animated:). You can use UIToolbar instead but there are a lot of options for customizing the navigation bar.
You can set the leftBarButtonItem, the titleView, or the rightBarButtonItem to be a custom view as specified in the UINavigationController class reference. Those properties take a UIBarButtonItem but that doesn't have to be a button. You can create a UIBarButtonItem using initWithCustomView: to create a UIBarButtonItem with any UIView. It can be a UIView that has multiple buttons as subviews or a search bar or segmented control or whatever views you need as long as they fit and don't violate the HIG. You can do that with any of the 3 custom views on the navBar.
1) Would apple accept the use of a UIToolBar in place of a Navigation
bar (with a custom "back" button", which would act as a replacement
for the Navigation Bar:
My advice, when faced with a "should I possibly violate the specification by working around it and hoping they don't mind" decision, is "no". Are you willing to spend the time to change the code to the meet the spec if they don't accept it?
2) Is this how Facebook would have achieved their top bar?
I'm not sure this is answerable.
3) IF I could use a toolbar instead of a Navigation Bar, i would have
a small space at the top where the toolbar would overlap the "status
bar" - how should i overcome this issue? - - would placing a A UIView,
in that position with an embedded Toolbar be the correct solution to
this issue?
I created an App with a Tool Bar AND a Navigation Bar. See the screen shots (Review page) here. The Tool Bar is at the top, beneath the navigation bar. At one point, I added a feature to make a tap on the navigation bar hide/show the tool bar. But since the longer displays came out, I have removed it. Most users don't really seem to mind the extra small hit at the top as long as the display provides the information they need.
Was this helpful?
1) Probably. I've not seen or heard of an example of Apple bothering to reject an app that used a toolbar rather than a navigation controller. However, you may get a reviewer having a bad day that decides to reject your app for that reason; it's really impossible to know for sure, but unlikely. I will say that I've submitted an app that looks similar to apps with a navigation controller but the top bar is custom, and it was accepted.
2) The Facebook top bar is most likely totally custom. You can see that the transparency effect is unlike the standard navigation bar's transparency, and the layout is not similar to any standard apple control.
3) Align your top bar (however you do it) with the topLayoutGuide in interface builder (or in code).

Resources