Questions about SplitViewController


#1

(Sorry. I previously posted this in the wrong Chapter)

  1. Can an application make use of a SplitViewController for some functions and a regular UIView for other parts? I read somewhere that once you use SVC you have to use it throughout the app.

  2. Why not have a pointer to the navigation controllers for the detailview, the listview, and the channelview. That way you wouldn’t have to build it every time.

  3. What is the purpose of adding the webview to the listview towards the beginning of this process?

Thanks,
Jeff


#2

Hi Jeff, here is what I think:

What you read was correct. If you use a SplitViewController, you have to use it throughout the whole app. From Apple’s documentation: https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/SplitViewControllers.html

According to UISplitViewController’s documentation, in a simple app configuration where you just have one Master View Controller, and one Detail View Controller, the common practice is to give them pointers to each other to simplify the communication between them. So I think this is the initial reason.

Second, even as our project got a little bit more complex, with the addition of the second detail view controller, ChannelViewController, we still want the post we tap on, on the master view controller, to always be displayed on a WebViewController detail view controller. And so the pointer we had to it in the beginning is now double useful, as we are sure that we are sending the message to the correct detail view controller (WebViewController).

If, however, we had been using [[[self splitViewController] viewControllers] objectAtIndex:1] to obtain a pointer to the SplitViewController’s detail view controller, we would be in risk of sending the messages to ChannelViewController, if it happened to be currently in display when we tapped on a post.

Hope this helps a little bit.

Gilmar


#3

Thanks, Gilmar.

I suppose one could hide the master view when a full screen is needed. And then unhide it when needed.