Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 12-22-2011, 08:25 AM   #1 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,002
Duncan C has a spectacular aura about
Default Child view controllers are cool!

With iOS 5, Apple added support for creating parent/child relationships between view controllers.

Before, you were pretty much limited to navigation controllers and tab bar controllers as a way to organize your view controllers, and it was all but impossible to have multiple view controller's views on the screen at once and make everything work correctly. (auto-rotation, low memory warnings, etc.)

In fact, the Apple docs explicitly state that for iPhone and iPod touch, a view controller's view must fill the whole screen.

All those things change, and in a very elegant way, with the new support for parent/child view controllers.

It's now easy and clean to create your own custom parent view controllers that manage child view controllers. You can create variations on navigation controllers or tab bar controllers that manage multiple child view controller that take up the whole screen, or you can create unique arrangements where a parent view controller divides the window up into sections and uses child view controllers to manage each section. This lets you write very modular code, and create cool effects.

Imagine, for example, a board game that supported a variety of different games. It could have a parent view controller in charge of the whole screen. It could have a subview dedicated to the game board, and invoke one of several game board controllers that was in charge of handling the game board area. It could have a chat view controller that was in charge of in-game chat, that worked across all the different games. It could also have a tool palette controller that managed the controls the user used to interact with the game.

There is a new method in UIViewController, transitionFromViewController:toViewController:dura tionptions:animations:completion:. It lets you switch from one child view controller to another, and supports a variety of "stock" transition styles. The list of transitions is missing some important ones like slide-from-left and slide-from-right, which is puzzling. However, because it takes an animation block as a parameter, it is trivial to implement the missing transitions yourself.

I've written a general purpose view controller transition method that takes a transition type enum as a parameter, and supports a large number of transitions. For the ones supported directly by transitionFromViewController:toViewController:dura tionptions:animations:completion:, it just requests that transition type. For the types I added, it specifies a transition type of none, and then uses the animations block to make the new transition type happen.

The transitionFromViewController:toViewController:dura tionptions:animations:completion: method is really powerful. It lets you easily implement just about any kind of transition on a portion of the screen or the whole screen. And, once you wrap your head around how to use block-style animations, it's EASY to use!
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 403
13 members and 390 guests
bignoggins, djqbert, Duncan C, epaga, flamingliquid, jcdevelopments, leighec68, markolo, mrtdmb, omagod, pinacate, revg, taylor202
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,645
Threads: 94,111
Posts: 402,862
Top Poster: BrianSlick (7,990)
Welcome to our newest member, leighec68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:01 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0