This is a noob question I'm sure.

I have a rootViewController. In it is a NSString thats been declared. The
rootViewController pushes another view onto the NavigationViewController...
loading that view. I'd like the loaded view to be able to access that string
variable. However, I am currently getting a null for it.


*RootViewController*
....

- (void)viewDidLoad {
    myString = @"foo";
    ....
}

- (NSString *)getString {
    return myString;
}

- (void)displaySecondView:(id)sender {
    UIViewController *menuViewController = [[MenuViewController alloc]
init];
    menuViewController.title = @"Menu";
    self.navigationItem.backBarButtonItem =
    [[UIBarButtonItem alloc] initWithTitle:@"Now Playing"
                                     style: UIBarButtonItemStyleBordered
                                    target:nil
                                    action:nil];
    [self.navigationController pushViewController:menuViewController
animated:YES];
    [menuViewController release];
}

*And now the view being pushed...
*
in the .h I import RootViewController

RootViewController *rootViewController

@property(nonatomic,retain) RootViewController *rootViewController
----------
in the .m

@synthesize rootViewController

- (void)viewDidLoad {
    NSString *tmp = [rootViewController getSourceLabel];
    NSLog(@"%@",tmp); // (null)
}

All I want to do is access methods in the RootViewController...







Interactive Designer and Developer
Google Voice: (508) 656-0622
http://blog.ericd.net
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to