Best practice to implement a custom splash screen with storyboard - ios5

I have been designing a custom splash screen using the following approach:
I have one splash creen controller that's been defined as a rootview controller in storyboard.
The splash screen controller is taking care of making a screenshot of itself and a custom container controller i would like to segue to. When the screenshots have all been taken care of, I allow the user to segue to the container controller (by doing a custom modal segue).
I think there are 2 problems with this approach:
The splash screen controller is still in memory even when i don't need it anymore.
I am loading the view for the first controller contains within my custom container controller 2 times: one when i am making a screenshot of the container controller and an other one when i am presenting modally the containerview controller.
Would it possible using storyboard to present modally the splashscreen just before the view for the container controller has even loaded? Can i have a custom segue when the splashscreen is being dismissed?

Related

How to enable user interaction for ViewControllers views inside UIPageViewContrller in swift

I am trying to to add UIPageViewController as a child to the MainViewController, the UIPageViewController has 2 ViewContrllers, the problem is I can't interact with any of the views
that belong to the view controllers of the ui page view controller, can't press buttons I tried to make userInteraction enabled for all the views inside the UIPageView Controller
also tried the NSLayoutConstraint but couldn't get it to work , this is the way i added the ui page view controller to the main controller as a child
let uiPC = MyUIPageViewController(vm: vm)
uiPC.view.frame = containerView.frame
containerView.addSubview(uiPC.view)
addChild(uiPC)
uiPC.didMove(toParent: self)
also tried the constraint solution to set the view of the page controller with the view of the container view but no luck, can't get the user interaction to be enabled.
the only way that work is either adding the views of the ViewControllers as a subview or add the 2 view controller of UIPageviewContoller as a child to the MainViewController
adding the UIPageViewController as a child inside the MainViewController
That is the expected behaviour of UIPageViewController in tvOS:
From the documentation:
Important In tvOS, the UIPageViewController class provides only a way
to swipe between full-screen content pages. Unlike in iOS, a user
cannot interact with or move focus between items on each page.
At the end I managed to get my design by embedding 2 view controllers in my view controller. A not interactive UIPageViewController in the background for the different pages, and another view controller on top with the buttons and clear background.
I also tried to implement an interactive UIPageViewController by using a UICollectionView with fullscreen cells and isPagingEnabled set to true. But, as documented, that is again not that easy in tvOS because isPaging is no available in tvOS.

split view controller in a custom container controller?

I am wondering if it is possible to present a splitviewcontroller within a custom container controller (or a tabbar controller)? I have seen from this doc and other post:
A split view controller must always be the root of any interface you
create. In other words, you must always install the view from a
UISplitViewController object as the root view of your application’s
window. [...] Split view controllers cannot be presented modally.
I have a splash screen in my app that will lead me to this container controller which I would like to contain a splitview controller. Is it just impossible according to Apple Programming guide or is there any workaround?
It is technically possible, but you run the risk of violating Apple UX guidelines.
What you can do is embed a splitview controller as a child viewcontroller of an blank UIViewController instance, and then present that viewcontroller instead of presenting the UISplitViewController directly.

What is the pattern for an Iphone app with both a View Controller and Tab Bar Controller?

I am trying to write an iPhone app that has both a UITabBar controller (and its associated views) and a plain vanilla view controller that is not part of the TabBar (i.e. an initial config page that only gets displayed the first time the app is run).
I am able to put a Tab Bar Controller and a View Controller in MainWindow.xib and shuffle between the two in the app delegate.
While this works I'm wondering if this is the best way to be implementing this.
It doesn't feel very "MVC-ish" to me but I think the two different controllers both need to be root (?)
I don't know how else I would do it.
If the config page is really only a "run once" affair, you could just pop it as a modal view from within the tab bar controller via the presentModalViewController:animated: method. (If on the other hand the config page is ever likely to be required in the future, I'd just add it as another option on the UITabBar.)
You would make the tabbarcontroller the default view. And present the viewcontroller modally in viewWillAppear or similar method. Then when you want to switch to the tabbar, you'd dismiss the modal view controller.

iPhone - nested views & controllers

Is it possible to have a single iPhone screen with its view loaded from a xib by that screen's UIViewController, but then another UIView within that screen with content loaded from a separate xib file? If so, is it possible to have that nested view's events handled by a separate custom UIViewController subclass from the rest of the screen? If both of these things are possible, are they also advisable?
It is possible. Apple suggests against having more than one UIViewController active on screen at once, so they would advise against. I would suggest only doing it if the reason for the second view controller is navigation or modal.
A view controller with the purpose of loading other view controllers, like a navigation controller, needs some screen space for itself and uses the rest to load another view controller. That is fine. The criteria here is that only one controller is presenting content while the other is presenting navigation.
A view controller could load another view controller to perform some limited task like selecting an item from a list or entering some text. The second view controller might only fill part of the screen. The criteria here is that the one controller behaves modally and will only be displayed long enough to get some user input.
As for the general case of splitting the screen between two view controllers that are presenting content, the Apple suggestion is that you have a single class derived from UIViewController manage the views. If the view is complex enough to warrant other controllers, then derive them from NSObject and have the master view controller manage the child controllers along with the views. The child controllers would have the master controller as a delegate, and the master controller would pass views to the child controllers to manage but not own.

Sliding Up/Down a UINavigationController

I have an app that uses a UINavigationController as its main way of showing data.I want a Settings screen to pop up, but I also want to be able to push new views for Settings. From what I've found, I can't use a UIViewController do to this. How can I present a view by sliding it, and also have content pushed onto it?
You can display the view for your view controller subclass either by presenting it modally (slides from the bottom and takes over the whole screen) or pushing it onto the navigation stack with animation (slides from the right and keeps the navigation bar).
In either case, you control the content of the view using your view controller subclass. Typically you update labels and controls in the viewWillAppear method.