Hi John,

I wonder if you can help me some more. I have 2 view controllers using
the initWithNibName method.
Both views load Ok, but I cannot get a button on the first view the
bring the second view to the front.
I have the button actions setup Ok, to call the view controller
IBAction, but I can't reference the window, or call a method in the
AppDelegate to switch the view either. I am stuck. Any help would be
great

Thanks

Paul

>>>>> Main App <<<<<<
#import "FirstController.h"
#import "SecondController.h"
#import "test3AppDelegate.h"

@implementation test3AppDelegate

@synthesize window;
@synthesize firstController;
@synthesize secondController;

- (void)applicationDidFinishLaunching:(UIApplication *)application {

        FirstController *first = [[FirstController alloc]
initWithNibName:@"FirstNIB" bundle:nil];
        self.firstController = first;
        [first release];

        SecondController *second = [[SecondController alloc]
initWithNibName:@"SecondNIB" bundle:nil];
        self.secondController = second;
        [second release];

        [window addSubview:[secondController view]];
        [window addSubview:[firstController view]];

        // Override point for customization after app launch
    [window makeKeyAndVisible];

}

- (void)changeView {
        [window bringSubviewToFront:[secondController view]];
}

- (void)dealloc {
        [secondController release];
        [firstController release];
        [window release];
        [super dealloc];
}

>>>>>> First Controller - with button action to call change view in delegate 
>>>>>> <<<<<<<<
#import "FirstController.h"
#import "test3AppDelegate.h"

@implementation FirstController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle
*)nibBundleOrNil {
        if (self = [super initWithNibName:nibNameOrNil
bundle:nibBundleOrNil]) {
                // Initialization code
        }
        return self;
}

- (IBAction)switchView:(id)sender {
        [test3AppDelegate changeView];
}

- (void)dealloc {
        [super dealloc];
}

@end


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to