Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cappuccino/cappuccino
Browse files Browse the repository at this point in the history
  • Loading branch information
aljungberg committed Mar 23, 2012
2 parents 3a00681 + 88783ef commit 3bc5605
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions AppKit/CPViewController.j
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var CPViewControllerCachedCibs;
{
CPView _view @accessors(property=view);
BOOL _isLoading;
BOOL _isLazy;

id _representedObject @accessors(property=representedObject);
CPString _title @accessors(property=title);
Expand Down Expand Up @@ -124,6 +125,7 @@ var CPViewControllerCachedCibs;
_cibExternalNameTable = anExternalNameTable || [CPDictionary dictionaryWithObject:self forKey:CPCibOwner];

_isLoading = NO;
_isLazy = NO;
}

return self;
Expand All @@ -139,8 +141,8 @@ var CPViewControllerCachedCibs;
implementation for programmatic views is to create a plain view. You can
invoke super to utilize this view.
If you use Interface Builder to create your views, you initialize the view
using the initWithCibName:bundle: method then you must not override this
If you use Interface Builder to create your views, and you initialize the view
using the initWithCibName:bundle: method, then you MUST NOT override this
method. The consequences risk shattering the space-time continuum.
Note: The cib loading system is currently synchronous.
Expand Down Expand Up @@ -199,6 +201,11 @@ var CPViewControllerCachedCibs;
_isLoading = NO;
[self viewDidLoad];
}
else if (_isLazy)
{
_isLazy = NO;
[self viewDidLoad];
}

return _view;
}
Expand All @@ -208,9 +215,9 @@ var CPViewControllerCachedCibs;
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. This method is
most commonly used to perform additional initialization steps on views
that are loaded from cib files.
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.
*/
- (void)viewDidLoad
{
Expand All @@ -228,13 +235,7 @@ var CPViewControllerCachedCibs;
*/
- (void)setView:(CPView)aView
{
var viewWasLoaded = !_view;

_view = aView;

// Make sure the viewDidLoad method is called if the view is set directly
if (!_isLoading && viewWasLoaded)
[self viewDidLoad];
}

@end
Expand Down Expand Up @@ -266,6 +267,7 @@ var CPViewControllerViewKey = @"CPViewControllerViewKey",
_cibBundle = bundlePath ? [CPBundle bundleWithPath:bundlePath] : [CPBundle mainBundle];

_cibExternalNameTable = [CPDictionary dictionaryWithObject:self forKey:CPCibOwner];
_isLazy = YES;
}

return self;
Expand Down

0 comments on commit 3bc5605

Please sign in to comment.