Objective-C - Unloading loaded view when it is swapped
        Posted  
        
            by teepusink
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by teepusink
        
        
        
        Published on 2010-04-28T20:19:46Z
        Indexed on 
            2010/04/28
            23:27 UTC
        
        
        Read the original article
        Hit count: 280
        
objective-c
|cocoa
Hi,
What is the best way to do view management in a multiview application?
Right now I have this ViewSwitcher method/function that comes from a custom delegate I created.
The code is a whole bunch of if else like this
    MyViewController *c = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
    c.delegate = self;
    self.myViewController = c;
    [self.viewHolder insertSubview:c.view atIndex:0];
    [c release];
That works fine, but when I visited the function a second time, is there going to be 2 instances of MyViewController now or just 1?
How do I unload MyViewController when I switch to another view?  
Or is there a better way to manage my views?
Thanks,
Tee
© Stack Overflow or respective owner