A URL-based navigation system with built-in persistence. More...

#import <TTBaseNavigator.h>

Inheritance diagram for TTBaseNavigator:
NSObject TTNavigator

List of all members.

Public Member Functions

(UIViewController *) - openURLAction:
 Load and display the view controller with a pattern that matches the URL.
(UIViewController *) - openURLs:
 Opens a sequence of URLs.
(UIViewController *) - viewControllerForURL:
 Gets a view controller for the URL without opening it.
(UIViewController *) - viewControllerForURL:query:
 Gets a view controller for the URL without opening it.
(UIViewController *) - viewControllerForURL:query:pattern:
 Gets a view controller for the URL without opening it.
(void) - beginDelay
 Tells the navigator to delay heavy operations.
(void) - endDelay
 Tells controllers that were created during the delay to finish what they were planning to do.
(void) - cancelDelay
 Cancels the delay without notifying delayed controllers.
(void) - persistViewControllers
 Persists all view controllers to user defaults.
(UIViewController *) - restoreViewControllers
 Restores all view controllers from user defaults and returns the last one.
(void) - persistController:path:
 Persists a view controller's state and recursively persists the next view controller after it.
(void) - removeAllViewControllers
 Removes all view controllers from the window and releases them.
(NSString *) - pathForObject:
 Gets a navigation path which can be used to locate an object.
(id) - objectForPath:
 Finds an object using its navigation path.
(void) - resetDefaults
 Erases all data stored in user defaults.
(void) - presentDependantController:parentController:mode:action:
(UIViewController *) - getVisibleChildController:
(Class) - navigationControllerClass

Static Public Member Functions

(TTBaseNavigator *) + navigatorForView:
 Determines the navigator that contains this view.
(TTBaseNavigator *) + globalNavigator
(void) + setGlobalNavigator:

Properties

UIWindowwindow
 The window that contains the view controller hierarchy.
id< TTNavigatorRootContainerrootContainer
 A container that holds the root view controller.
UIViewControllerrootViewController
 The controller that is at the root of the view controller hierarchy.
UIViewControllervisibleViewController
 The currently visible view controller.
UIViewControllertopViewController
 The view controller that is currently on top of the navigation stack.
NSStringURL
 The URL of the currently visible view controller;.
NSStringpersistenceKey
 The key to use for storing persistence information.
TTNavigatorPersistenceMode persistenceMode
 How view controllers are automatically persisted on termination and restored on launch.
NSTimeInterval persistenceExpirationAge
 The age at which persisted view controllers are too old to be restored.
BOOL supportsShakeToReload
 Causes the current view controller to be reloaded when shaking the phone.
BOOL opensExternalURLs
 Allows URLs to be opened externally if they don't match any patterns.
BOOL isDelayed
 Indicates that we are asking controllers to delay heavy operations until a later time.
id< TTNavigatorDelegatedelegate

Detailed Description

A URL-based navigation system with built-in persistence.


Member Function Documentation

- (void) beginDelay  

Tells the navigator to delay heavy operations.

Initializing controllers can be very expensive, so if you are going to do some animation while this might be happening, this will tell controllers created through the navigator that they should hold off so as not to slow down the operations.

+ (TTBaseNavigator *) navigatorForView: (UIView*)  view  

Determines the navigator that contains this view.

Traverse the view hierarchy until the root view container is reached. If this root container conforms to the TTNavigatorRootContainer protocol, we call getNavigatorForController: with the top-most controller that contains this view that /isn't/ the container. If getNavigatorForController: returns a navigator, this navigator is returned. Otherwise, the global navigator is returned.

If the given view is not, in fact, a view, which is the case if a UIBarButtonItem is passed, returns the global navigator via [TTBaseNavigator globalNavigator].

If you need to use a specific navigator for UIBarButtonItem, handle the button tap yourself and use navigatorForView: on an actual view in the controller.

- (UIViewController *) openURLAction: (TTURLAction*)  URLAction  

Load and display the view controller with a pattern that matches the URL.

This method replaces all other openURL methods by using the chainable TTURLAction object.

If there is not yet a rootViewController, the view controller loaded with this URL will be assigned as the rootViewController and inserted into the keyWindow. If there is not a keyWindow, a UIWindow will be created and displayed.

Example TTURLAction initialization: [[TTURLAction actionWithURLPath:"tt://some/path"] applyAnimated:YES]

Each apply* method on the TTURLAction object returns self, allowing you to chain methods when initializing the object. This allows for a flexible method that requires a shifting set of parameters that have specific defaults. The old openURL* methods are being phased out, so please start using openURLAction instead.

- (UIViewController *) openURLs: (NSString*)  URL
,   ... 

Opens a sequence of URLs.

Returns:
The view controller of the last opened URL.
- (void) persistController: (UIViewController*)  controller
path: (NSMutableArray*)  path 

Persists a view controller's state and recursively persists the next view controller after it.

Do not call this directly except from within a view controller that is being directed by the app map to persist itself.

- (UIViewController *) viewControllerForURL: (NSString*)  URL  

Gets a view controller for the URL without opening it.

Returns:
The view controller mapped to URL.
- (UIViewController *) viewControllerForURL: (NSString*)  URL
query: (NSDictionary*)  query 

Gets a view controller for the URL without opening it.

Returns:
The view controller mapped to URL.
- (UIViewController*) viewControllerForURL: (NSString *)  URL
query: (NSDictionary *)  query
pattern: (TTURLPattern **)  pattern 

Gets a view controller for the URL without opening it.

Returns:
The view controller mapped to URL.

Property Documentation

- (BOOL) isDelayed [read, assign]

Indicates that we are asking controllers to delay heavy operations until a later time.

NO

- (BOOL) opensExternalURLs [read, write, assign]

Allows URLs to be opened externally if they don't match any patterns.

NO

- (NSTimeInterval) persistenceExpirationAge [read, write, assign]

The age at which persisted view controllers are too old to be restored.

In some cases, it is a good practice not to restore really old navigation paths, because the user probably won't remember how they got there, and would prefer to start from the beginning.

Set this to 0 to restore from any age.

0

- (NSString*) persistenceKey [read, write, copy]

The key to use for storing persistence information.

Three bits of information are stored for persistence. If a key name is given, these values will first be stored within a dictionary and then persisted with the given key name. If a key name is not given, the values are stored individually.

nil

- (TTNavigatorPersistenceMode) persistenceMode [read, write, assign]

How view controllers are automatically persisted on termination and restored on launch.

TTNavigatorPersistenceModeNone

- (id<TTNavigatorRootContainer>) rootContainer [read, write, assign]

A container that holds the root view controller.

If nil, the window is treated as the root container.

nil

- (BOOL) supportsShakeToReload [read, write, assign]

Causes the current view controller to be reloaded when shaking the phone.

NO

- (UIViewController *) topViewController [read, assign]

The view controller that is currently on top of the navigation stack.

This differs from visibleViewController in that it ignores things like search display controllers which are visible, but not part of navigation.

- (NSString *) URL [read, write, copy]

The URL of the currently visible view controller;.

Setting this property will open a new URL.

- (UIWindow *) window [read, write, retain]

The window that contains the view controller hierarchy.

By default retrieves the keyWindow. If there is no keyWindow, creates a new TTNavigatorWindow.


The documentation for this class was generated from the following files:
  • Three20UINavigator/Headers/TTBaseNavigator.h
  • Three20UINavigator/Sources/TTBaseNavigator.m
blog comments powered by Disqus