- Inherits From:
- NSView
- Declared In:
- EDSwapView.h
The main advantage of EDSwapView are the instance variables and methods dealing with view numbers, allowing the developer to wire up the entire interface in IB. (Zero code approach.)
NSMutableSet *views;
NSMutableSet *visibleViews;
struct EDSVFlags flags;
id delegate;
IBOutlet NSView *view0;
IBOutlet NSView *view1;
IBOutlet NSView *view2;
IBOutlet NSView *view3;
IBOutlet NSView *view4;
views These instance variables are private. visibleViews flags delegate view0 Connect in Interface Builder. view1 view2 view3 view4
Managing views by numberManaging views by object reference
- - setView0:
- - view0
- - setView1:
- - view1
- - setView2:
- - view2
- - setView3:
- - view3
- - setView4:
- - view4
- - switchToViewNumber:
- - takeViewNumber:
Assigning a delegate
- - addView:
- - addView:atPoint:
- - removeView:
- - showView:
- - hideView:
- - switchToView:
- - hideAllViews
- - isShowingView:
- - visibleViews
- - setDelegate:
- - delegate
- (void)addView:(NSView *)aView
Calls addView:atPoint: with NSZeroPoint
.
- (void)addView:(NSView *)aView atPoint:(NSPoint)point
Adds aView to the receiver's list of views to be displayed at point. This does not make the view visible. It does remove the view from it's superview; provided it had one before. None if the viewX variables are affected.
- (id)delegate
Returns the receiver's delegate.
- (void)hideAllViews
Ensures that no views are visible. If any view needs to be swapped out the corresponding delegate method is called.
- (void)hideView:(NSView *)aView
Ensures that aView is not visible. If the view needs to be swapped out and a delegate exists and implements swapView:willSwapoutView: this method is called before the view is swapped out but after window flushing is disabled.
- (BOOL)isShowingView:(NSView *)aView
Returns YES if aView is currently visible.
- (void)removeView:(NSView *)aView
Removes aView from the receiver's list of views. If the view was visible it is hidden first.
- (void)setDelegate:(id)anObject
Sets the receiver's delegate to anObject.
- (void)setView0:(NSView *)aView
Sets view0 to aView and adds it to the receiver's list of views. If aView is an NSBox its contents are used instead.
- (void)setView1:(NSView *)aView
Sets view1 to aView and adds it to the receiver's list of views. If aView is an NSBox its contents are used instead.
- (void)setView2:(NSView *)aView
Sets view2 to aView and adds it to the receiver's list of views. If aView is an NSBox its contents are used instead.
- (void)setView3:(NSView *)aView
Sets view3 to aView and adds it to the receiver's list of views. If aView is an NSBox its contents are used instead.
- (void)setView4:(NSView *)aView
Sets view4 to aView and adds it to the receiver's list of views. If aView is an NSBox its contents are used instead.
- (void)showView:(NSView *)aView
Ensures that aView is visible. If the view needs to be swapped in and a delegate exists and implements swapView:didSwapinView: this method is called after the view is swapped in but before the window is flushed.
- (void)switchToView:(NSView *)aView
Ensures that only aView is visible. If any view needs to be swapped in or out the corresponding delegate methods are called.
- (void)switchToViewNumber:(int)number
Calls switchToView: with the corresponding view from the viewX instance variables.
- (IBAction)takeViewNumber:(id)sender
Calls switchToViewNumber: with the view number taken from the sender. If this is an NSPopUpButton or NSMatrix the tag of the selected item/cell is used, if it is an NSButton this method returns 1 if the button's state is NSOnState
and zero otherwise, and in all other cases it returns the tag of the sender.
- (NSView *)view0
Returns view0, or nil
if this has not been set.
- (NSView *)view1
Returns view1, or nil
if this has not been set.
- (NSView *)view2
Returns view2, or nil
if this has not been set.
- (NSView *)view3
Returns view3, or nil
if this has not been set.
- (NSView *)view4
Returns view4, or nil
if this has not been set.
- (NSArray *)visibleViews
Returns an array containing all views that are currently visible.