API  0.9.10
CPViewController Class Reference

#import <CPViewController.h>

+ Inheritance diagram for CPViewController:

Instance Methods

(BOOL) - automaticallyNotifiesObserversOfIsViewLoaded
 
(CPBundle- cibBundle
 
(CPDictionary- cibExternalNameTable
 
(CPString- cibName
 
(void) - encodeWithCoder:
 
(id) - init
 
(id) - initWithCibName:bundle:
 
(id) - initWithCibName:bundle:externalNameTable:
 
(id) - initWithCibName:bundle:owner:
 
(id) - initWithCoder:
 
(BOOL) - isViewLoaded
 
(void) - loadView
 
(void) - loadViewWithCompletionHandler:
 
(id) - representedObject
 
(void) - setRepresentedObject:
 
(void) - setTitle:
 
(void) - setView:
 
(CPString- title
 
(CPView- view
 
(void) - viewDidAppear
 
(void) - viewDidDisappear
 
(void) - viewDidLoad
 
(void) - viewWillAppear
 
(void) - viewWillDisappear
 
- Instance Methods inherited from CPResponder
(BOOL) - acceptsFirstResponder
 
(BOOL) - becomeFirstResponder
 
(void) - cursorUpdate:
 
(void) - doCommandBySelector:
 
(void) - flagsChanged:
 
(void) - insertBackTab:
 
(void) - insertLineBreak:
 
(void) - insertNewline:
 
(void) - insertTab:
 
(void) - insertText:
 
(void) - interpretKeyEvents:
 
(void) - keyDown:
 
(void) - keyUp:
 
(CPMenu- menu
 
(void) - mouseDown:
 
(void) - mouseDragged:
 
(void) - mouseEntered:
 
(void) - mouseExited:
 
(void) - mouseMoved:
 
(void) - mouseUp:
 
(CPResponder- nextResponder
 
(void) - noResponderFor:
 
(BOOL) - performKeyEquivalent:
 
(BOOL) - resignFirstResponder
 
(void) - rightMouseDown:
 
(void) - rightMouseUp:
 
(void) - scrollWheel:
 
(void) - setMenu:
 
(void) - setNextResponder:
 
(BOOL) - tryToPerform:with:
 
(CPUndoManager- undoManager
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPString- description
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray) - exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(void) - performSelector:withObject:afterDelay:
 
(void) - performSelector:withObject:afterDelay:inModes:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Class Methods

(void) + initialize
 
- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(void) + cancelPreviousPerformRequestsWithTarget:
 
(void) + cancelPreviousPerformRequestsWithTarget:selector:object:
 
(Class) + class
 
(BOOL) + conformsToProtocol:
 
(void) + exposeBinding:
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesImplementSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isBindingExclusive:
 
(BOOL) + isSubclassOfClass:
 
(CPSet) + keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + object:performSelector:withObject:afterDelay:inModes:
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Detailed Description

The CPViewController class provides the fundamental view-management controller for Cappuccino applications. The basic view controller class supports the presentation of an associated view in addition to basic support for managing modal views and, in the future, animations. Subclasses such as CPNavigationController and CPTabBarController provide additional behavior for managing complex hierarchies of view controllers and views.

You use each instance of CPViewController to manage a single view (and hierarchy). For a simple view controller, this entails managing the view hierarchy responsible for presenting your application content. A typical view hierarchy consists of a root view, a reference to which is available in the view property of this class, and one or more subviews presenting the actual content. In the case of navigation and tab bar controllers, the view controller manages not only the high-level view hierarchy (which provides the navigation controls) but also one or more additional view controllers that handle the presentation of the application content.

Unlike UIViewController in Cocoa Touch, a CPViewController does not represent an entire screen of content. You will add your root view to an existing view or window's content view. You can manage many view controllers on screen at once. CPViewController is also the preferred way of working with Cibs.

Subclasses can override -loadView to create their custom view hierarchy, or specify a cib name to be loaded automatically. It has methods that are called when a view appears or disappears. This class is also a good place for delegate & datasource methods, and other controller stuff.

Definition at line 2 of file CPViewController.h.

Method Documentation

◆ automaticallyNotifiesObserversOfIsViewLoaded()

- (BOOL) automaticallyNotifiesObserversOfIsViewLoaded
implementation

Definition at line 412 of file CPViewController.j.

◆ cibBundle()

- (CPBundle) cibBundle
implementation

Synthesized accessor method.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 561 of file CPViewController.j.

◆ cibExternalNameTable()

- (CPDictionary) cibExternalNameTable
implementation

Synthesized accessor method.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 569 of file CPViewController.j.

◆ cibName()

- (CPString) cibName
implementation

Synthesized accessor method.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 553 of file CPViewController.j.

◆ encodeWithCoder:()

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Archives the view controller to the provided coder.

Parameters
aCoderthe coder to which the view controller should be archived

Reimplemented from CPResponder.

Provided by category CPViewController(CPCoding).

Definition at line 480 of file CPViewController.j.

◆ init()

- (id) init
implementation

Convenience initializer calls -initWithCibName:bundle: with nil for both parameters.

Reimplemented from CPObject.

Definition at line 89 of file CPViewController.j.

◆ initialize()

+ (void) initialize
implementation

Reimplemented from CPObject.

Definition at line 78 of file CPViewController.j.

◆ initWithCibName:bundle:()

- (id) initWithCibName: (CPString aCibNameOrNil
bundle: (CPBundle aCibBundleOrNil 
implementation

Definition at line 94 of file CPViewController.j.

◆ initWithCibName:bundle:externalNameTable:()

- (id) initWithCibName: (CPString aCibNameOrNil
bundle: (CPBundle aCibBundleOrNil
externalNameTable: (CPDictionary anExternalNameTable 
implementation

The designated initializer. If you subclass CPViewController, you must call the super implementation of this method, even if you aren't using a Cib.

In the specified Cib, the File's Owner proxy should have its class set to your view controller subclass, with the view outlet connected to the main view. If you pass in a nil Cib name, then you must either call -setView: before -view is invoked, or override -loadView to set up your views.

Parameters
cibNameOrNilThe path to the cib to load for the root view or nil to programmatically create views.
cibBundleOrNilThe bundle that the cib is located in or nil for the main bundle.

Definition at line 117 of file CPViewController.j.

◆ initWithCibName:bundle:owner:()

- (id) initWithCibName: (CPString aCibNameOrNil
bundle: (CPBundle aCibBundleOrNil
owner: (id)  anOwner 
implementation

Definition at line 99 of file CPViewController.j.

◆ initWithCoder:()

- (id) initWithCoder: (CPCoder aCoder
implementation

Initializes the view controller by unarchiving data from a coder.

Parameters
aCoderthe coder from which the data will be unarchived
Returns
the initialized view controller

Reimplemented from CPResponder.

Provided by category CPViewController(CPCoding).

Definition at line 456 of file CPViewController.j.

◆ isViewLoaded()

- (BOOL) isViewLoaded
implementation

Synthesized accessor method.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 513 of file CPViewController.j.

◆ loadView()

- (void) loadView
implementation

Programmatically creates the view that the controller manages. You should never call this method directly. The view controller calls this method when the view property is requested but is nil.

If you create your views manually, you must override this method and use it to create your view and assign it to the view property. The default implementation for programmatic views is to create a plain, zero width & height view. You can invoke super to utilize this view.

If you use Interface Builder to create your views, and you initialize the controller using the initWithCibName:bundle: methods, then you MUST NOT override this method.

Note
When using this method, the cib loading system is synchronous. See the loadViewWithCompletionHandler: method for an asynchronous loading.

Definition at line 152 of file CPViewController.j.

◆ loadViewWithCompletionHandler:()

- (void) loadViewWithCompletionHandler: (Function/*(view, error)*/)  aHandler
implementation

Asynchronously load the cib and create the view that the controller manages.

Parameters
aHandlera function which will be passed the loaded view as the first argument and a network error or nil as the second argument: function(view, error).
Note
If the view has already been loaded, the completion handler is run immediatly and the process is synchronous.

Definition at line 184 of file CPViewController.j.

◆ representedObject()

- (id) representedObject
implementation

Synthesized accessor method.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 521 of file CPViewController.j.

◆ setRepresentedObject:()

- (void) setRepresentedObject: (id)  aValue
implementation

Synthesized accessor method.

Reimplemented in CPCollectionViewItem.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 529 of file CPViewController.j.

◆ setTitle:()

- (void) setTitle: (CPString aValue
implementation

Synthesized accessor method.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 545 of file CPViewController.j.

◆ setView:()

- (void) setView: (CPView aView
implementation

Manually sets the view that the controller manages.

Setting to nil will cause -loadView to be called on all subsequent calls of -view.

Parameters
aViewThe view this controller should represent.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 395 of file CPViewController.j.

◆ title()

- (CPString) title
implementation

Synthesized accessor method.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 537 of file CPViewController.j.

◆ view()

- (CPView) view
implementation

Returns the view that the controller manages.

If this property is nil, the controller sends loadView to itself to create the view that it manages. Subclasses should override the loadView method to create any custom views. The default value is nil.

Provided by category CPViewController(CPSynthesizedAccessors).

Definition at line 243 of file CPViewController.j.

◆ viewDidAppear()

- (void) viewDidAppear
implementation

Called when the view controller’s view is fully transitioned onto the screen.

This method is called after the completion of any drawing and animations involved in the initial appearance of the view. You can override this method to perform tasks appropriate for that time, such as work that should not interfere with the presentation animation, or starting an animation that you want to begin after the view appears.

If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.

The default implementation of this method does nothing.

Definition at line 346 of file CPViewController.j.

◆ viewDidDisappear()

- (void) viewDidDisappear
implementation

Called after the view controller’s view is removed from the view hierarchy in a window.

You can override this method to perform tasks associated with removing the view controller’s view from the window’s view hierarchy, such as releasing resources not needed when the view is not visible or no longer part of the window.

If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.

The default implementation of this method does nothing.

Definition at line 382 of file CPViewController.j.

◆ viewDidLoad()

- (void) viewDidLoad
implementation

This method is called after the view controller has loaded its associated views into memory.

This method is called regardless of whether the views were stored in a nib file or created programmatically in the loadView method, but NOT when setView is invoked. This method is most commonly used to perform additional initialization steps on views that are loaded from cib files.

Definition at line 308 of file CPViewController.j.

◆ viewWillAppear()

- (void) viewWillAppear
implementation

Called after the view controller’s view has been loaded into memory is about to be added to the view hierarchy in the window.

You can override this method to perform tasks prior to a view controller’s view getting added to view hierarchy, such as setting the view’s highlight color. This method is called when:

• The view is about to be added to the view hierarchy of the view controller

If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.

The default implementation of this method does nothing.

Definition at line 327 of file CPViewController.j.

◆ viewWillDisappear()

- (void) viewWillDisappear
implementation

Called when the view controller’s view is about to be removed from the view hierarchy in the window.

You can override this method to perform tasks that are to precede the disappearance of the view controller’s view, such as stopping a continuous animation that you started in response to the viewDidAppear method call. This method is called when:

• The view is about to be removed from the view hierarchy of the window

If you override this method, call this method on super at some point in your implementation in case a superclass also overrides this method.

The default implementation of this method does nothing.

Definition at line 365 of file CPViewController.j.


The documentation for this class was generated from the following files: