I'm a little bit confused about view-hierarchies when they meet ADBannerViews.
I want to insert iAd-Banners programmatically into an existing app, but I don't know where to start. I did read apples documentation and watched a really good WWDC-video, but I still have difficulties to understand how I can use this informations to bring ads in a propper way into my app.
Here is the architecture of my app:
At the bottom there is the window.
The rootViewController of that window is a UINavigationController.
The first viewController in the navigationControllers stack is a UITabBarController.
This tabBarController holds five simmilar UITableViews.
Tabbing on one of the tableCells of one of this tableViews pushes a new viewcontroller onto the navigationControllers stack.
This new viewController is again a UITabBarController, but this one has just four tabs, and the four Viewcontrollers in this tabBarControllers array are:
two different UITableViewControllers
two different simple UIViewControllers, one with just a single picture, the other with many nested views.
I want to insert an ADBannerView at the bottom of each of this four children of the second tabBarController in the navigationControllers stack. And I am not shure how to to this.
My problem is: I do not understand what will happen when the user tabs onto the ad. I know, that the ad's code will push a new view over my app, but I do not understand how. Will the new view be part of the stack of my navigationController (I don't think so)? Or will the new view be a new subview of one of the tabBarControllers views?
I don't have any proof, but my guess is that when the user taps on the banner, the ADBannerView code will push a new subview onto the view of the root view controller, because it needs to display full screen, on top of everything in your application. The root view controller is typically set in your applicationDidFinishLaunchingWithOptions method.
p.s. off topic a bit but are you sure you want to change the number of tabs? The more conventional UI paradigm is the tabs stay constant at the bottom of the screen. In that case, you have a UITabBarController with several UINavigationControllers under it.
Related
I have an application with a drop down menu as the titleView of my NavigationController. When a user selects an item of the drop down menu, the entire view should switch contents, however, the NavigationBar should remain the same. The NavigationBar should not have to reload any data and the titleView should remain a drop down menu.
The original view upon opening the app:
The view upon touching the dropdown menu:
I currently see a few ways of going about this:
Set up a UIViewController for each option, perform the segue, and reload the data.
Why this is bad: I will have to set up a segue identifier for each ViewController, meaning if I have 15 options in my drop down menu, I will have 210 segue identifiers laying around. I will also have to reload all of my NavigationBar data.
Why this is good: I will have a clear area to set up each individual view.
Programmatically add and remove UIButtons, UILabels, and UIWhatevers as I need them.
Why this is bad: This will create a lot of code inside just one ViewController and things could get difficult to debug.
Why this is good: The NavigationBar never gets reloaded.
Add a container and embed a unique ViewController for each item as I need it.
Why this is bad: All of my work would still be in the main ViewController and I'd have to manage the logic of the embedded ViewController inside one Controller.
Why this is good: The NavigationBar never gets reloaded.
A completely different method suggested by someone else because I don't know the most efficient way of doing this.
So, in conclusion, what is the most efficient way to maintain state of my NavigationBar when switching my main content in my View?
Option 3 is the best out of the three you listed. Options 1 and 2 will get more and more complicated the more view controllers you want to add. Compare that to UINavigationController, UITabBarController, or UIPageViewController which do not need to be more complicated in order to handle 10 screens vs. 100 screens.
I would suggest creating a custom container view controller (Apple's Reference)
I see 2 immediate approaches to implementing this:
Subclassing UIViewController - this is how Apple's container view controllers are implemented
Subclass UITabBarController - I have done this successfully, subclassing UITabBarController to show a custom tab bar at the top instead of along the bottom.
I have this problem and I can't seem to find the answer so I asked here. I need to overlap 2 UIViewControllers. It is in a navigation controller. Each Controllers is using xib files as view since I am not using storyboard. It needs to be overlapped since the first controller is on live feed and I cannot afford to use a screenshot for background to make the live feed stay on while the user is navigating on the second controller. Any Ideas?
try content views doc tutorial
and the VC which you want to overlap, you will not keep it in you navigation stack, you will have to make overlapping VC, child of the VC on which you want to present it, after making child you will add child VC's view as a subview to parent's view. in that way both view controllers will appear to be overlapping
I have a UITabBarController that has 2 items. Each of them points to a different UINavigationController, however both of them point to the same UIViewController. The first item is displayed correctly but the second on is not. What's happening.
No code is necessary for reproducing it.
A view controller can't be in different navigation controllers at the same time. You need two scenes here. This is one reason why I don't like Storyboards.
As I understand it, one of the best ways of handling opening Views upon clicking a particular tableViewCell is by pushing to the ViewController.
However, this apparently only works if you only embed the ViewController in a NavigationController.
Would you then have to embed each individual ViewController in an Navigation Controller?
This sounds sort of repetitive and tedious - is this good practice?
This tutorial uses navigation controllers on all of the view controllers, but doesn't really say why
I just use one navigation controller, and it works fine for me. I've used one and had segues between multiple viewControllers including several tables as well as using buttons in some places, and still been able to navigate super easily. In main.storyboard, just select the first view that's going to be a part of it, then go to Editor>Embed In>Navigation Controller. Then, you just add in your segues (I believe they should all be Show(e.g. Push) segues to work correctly)
When running your app, there should be a bar at the top which can be used to go back (you can also edit the bar by adding other buttons or changing the color and title).
Here's some documentation from apple
I am new to xcode and IOS (and this board. First post).
I am completely flummoxed by a design problem and unsure how to approach.
I have three buttons, each of which calls a new array of pages that need to navigate horizontally with swipe gestures and have their own buttons.
The three buttons in the parent work exactly like a tab bar except they have to be bigger and higher than a tab bar would be. The called page arrays mostly work like a pageviewcontroller except that the pages need to have a button/indicator below to allow non sequential navigation. The target HAS TO LOAD WITH A SEGUE.
The problem I'm encountering is that using a modal segue to load a pageviewcontroller and prepareForSegue to keep the master/parent view controller visible results in my buttons being inaccessible. I assume its because I cant click thought the child view controller.
Secondly, I don't know if its possible to customize the page indicator dots of a pageviewcontroller so they can look like a bar with graphics.
Here are my specific questions:
Is it possible to load a view controller with a modal segue and still access my buttons? Can the child be resized?
can i customize the buttons/indicators in a pageviewcontroller. Can you point me to some code?
should navigation like this be done with some completely different approach? What about a view controller container?
Here's a diagram (cant post images directly yet)
I've found the answer to my second question: It seems that pageViewController's indicators are not customizable in any way. This rules out pageViewController for what I need.
9 Views in 10 hours. Is this not the best forum for questions like this or is there something wrong with my post?