I started an iPhone App with the Xcode template for UITabBarController, which created a couple of default UIViews (MainWindow, FirstView and SecondView).
The MainWindow xib shows the tabbar itself, which can be configured there.
FirstView and SecondView have an unselectable UITabBar anchored to the bottom, which is ostensibly to show the relationship to MainWindow.
Note that I've created many new views that are part of the main UITabBar and they work fine, but they don't show that UITabBar at the bottom in Interface Builder.
My question is, how does that work, and how can I create a new view such that it will show that unselectable UITabBar at the bottom?
What you're seeing is simply Interface Builder's "simulated metrics" and it shouldn't actually have any bearing on the app's behavior. But this is how you can change it:
Related
My current project has a UITabBarController and in the UIViewController I have a ScrollView and inside that I have a Stack View.
The new default behaviour for the UITabBarController is to be pinned to the screen and allow the content to scroll underneath it.
But you are able to set an instance property to allow the tab bar to scroll away with the content as you navigate down.
I'm trying to set the instance property tabBarObservedScrollView in the viewWillAppear of the viewController as mentioned in the WWDC video at min 38 here: https://developer.apple.com/videos/play/wwdc2019/211/
But the problem I'm getting is that it doesn't scroll away. I've put a sample application together in GitHub so I can share it here to see if I'm doing something wrong.
If anyone has come across this issue already I'd be pleased to know how to fix it. Thanks :-)
https://github.com/kyazdani/TVTabBarScrollAway
You need to set tabBarObservedScrollView on the actual view controller that is part of the array of view controllers that the UITabBarController handles.
In your example code you set it on the scroll view, but it's your UINavigationController that the UITabBarController manages, you need to set it there.
I'm trying to create a custom UICollectionViewCell backed by a *.xib file.
However, when I try to add subviews to the cell, interface builder (as well as an actual instance of the cell inside the app) doesn't show them at all.
It doesn't matter whether I add in an UIView as a contentView or not, all subviews seem to be invisible.
This happens in Xcode 7.2 inside a tvOS project. Does anyone experience the same issue or can see what I'm missing?
I try to build a simple app based on the UISplitViewController template from Xcode 6 for universal apps (with Storyboard and CoreData/NSFetchedResultsController). This app should also provide a search bar for the MasterViewController. Unfortunately, Xcode 6 provides no InterfaceBuilder element for the UISearchBar/UISearchController combo (only the depreciated UISearchBar/UISearchDisplayController).
In the iOS Developer library, Apple provides the "Table Search with UISearchController" example, but this is not based on the UISplitViewController and supports only iPhone.
My problem is, that I'm not able to show the detail view on the correct ViewController under all circumstances. I tried to transfer the approach from the Apple example project to the UISplitViewController template. In this, one is encouraged to show the search results in a separate UITableViewController subclass (ResultsTableViewController) and use this as the searchResultsController of the UISearchController. I was not able to create a scene in InterfaceBuilder for this setup so I had to add these manually in code.
The problems begin when I click on a table cell of the ResultsTableViewController. This vc is not part of the scene in InterfaceBuilde and I don't know how to add it to the SplitViewController setting correctly. The biggest problem is the weird behavoir of the iPhone 6 Plus and the UISplitViewController. In portrait mode it behaves like an iPhone and doesn't seem to have a SplitViewController and only uses a NavigationController to which I push my DetailViewController. In landscape mode it behaves like an iPad with SplitViewController were I have to get the second ViewController of the SplitViewController childControllers and push the DetailViewController on this one.
Now it happens, when I start in portrait mode and switch to landscape mode that the DetailViewController is all gone, showing gray space where the DetailVC should be. It seems, when going to portrait mode, the DetailViewController gets kicked from the SplitViewController (or the SplitViewController gets kicked at all in favor for the iPhones NavigationController setup). When switching back to landscape the SplitViewController is initialized again but without proper initialization of the DetailViewController.
Is there any template or suggestion on how to correctly implement search capabilities on a universal UISplitViewController?
Cheers
Björn
When opening up a project today, there is some weird behavior in XCode. Things have disappeared in the storyboard view like the NavigationBar in viewController, the buttons associated with it, etc. I can see in the Scene list that they still exist. Is there any way to have these show up again?
You probably need to add a navigation controller to your storyboard and make your view controller the root. You cannot simply set the top bar in simulated metrics in storyboard to navigation bar.
I am trying to build an fairly simple iPad app that requires me to navigate through multiple views. What I want to do is have some sort of main menu view with multiple buttons on it, and when you click one of the buttons the new view appears and then you work with that. I'm new to iPad development, so I have a few questions about the best way to get this done.
1) If I build the views in Interface Builder, how do I make them aware of each other in Xcode? I can't seem to figure out what I need to do in order to code a button to say "Open View 'Foo'"
2) When I open the views, how should I be adding them in relation to the main menu view? Should I add the new view as a subview of the main menu view, or should I close the main menu view, open the new view, and then reopen the main menu upon closing the first view? I imagine both ways are possible, but are there any performance implications I should be aware of?
Thanks,
Mike
I'm making an assumption that it's more or less the same between iPhone and iPad. I haven't started iPad development yet.
You make view controllers aware of each other by importing their headers in your implementation files
FirstViewController.m
#import "SecondViewController.h"
If you're going for a navigation-style app, you should embed your top level view controller in a navigation controller, then you advance to the next one by calling
SecondViewController *secondVC = [[SecondViewController alloc] initWithNibName:#"SecondViewController" bundle:nil];
//set any properties
[self.navigationController pushViewController:secondVC animated:YES];
[secondVC release];