Commits

Anonymous committed c09c8ef

Publishing a .parentViewController property for view controllers

  • Participants
  • Parent commits ef4029a

Comments (0)

Files changed (2)

File BWViewController.h

 @interface BWViewController : NSViewController
 {
   @private
-    NSString    *_identifier;
+    NSString            *_identifier;
+    BWViewController    *_parent;   // weak ref
 }
 
 @property(nonatomic, copy) NSString *identifier;
+@property(nonatomic, assign) BWViewController *parentViewController;
 
 @end
 
 - (void)viewWillDisappear:(BOOL)animated;
 - (void)viewDidDisappear:(BOOL)animated;
 
+
+// Default implementation does nothing. If desired in a subclass, override to store a *weak* reference
+- (void)setParentViewController:(BWViewController *)parent;
+
+
 @end

File BWViewController.m

 }
 
 @synthesize identifier = _identifier;
+@synthesize parentViewController = _parent;
 
 @end
 
 - (void)viewWillDisappear:(BOOL)animated; { }
 - (void)viewDidDisappear:(BOOL)animated; { }
 
+- (void)setParentViewController:(BWViewController *)parent; { }
+
 @end