Cecile
Cecile

Reputation:

self "not a structure or a union" in a UIViewController class. Why?

I have spent a lot of time trying to figure out what the problem is... but with no success.

My code is the following:

ResultGoalViewController *resultGoalViewController = [[ResultGoalViewController alloc] initWithNibName:@"ResultGoalViewController" bundle:nil];

[self.goalNavigationController pushViewController:resultGoalViewController animated:YES];

I get the error: "error:Request for member 'goalNavigationController' in something not a structure or a union."

My class is UIViewController. goalNavigationController is a Navigation Controller (defined within a Tab Controller).

What am I missing?

Upvotes: 0

Views: 245

Answers (3)

Cecile
Cecile

Reputation:

Thanks Chuck, thanks Mipadi.

I have a goalNavigationController property in the delegate application.

@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UITabBarController *mytabBarController;
NavigationGoalViewController *goalNavigationController; 

}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) NavigationGoalViewController *goalNavigationController;

@end

But it's not in my current UIViewController Class, as my goalNavigationController was first built/called within my delegate application. I am now calling it from the ViewController of the first view of my Navigation (I am trying to load the second view of my navigation controller).

Upvotes: 0

Chuck
Chuck

Reputation: 237040

It sounds like self doesn't have a goalNavigationController property. If it does, you should post where it's declared so we can see that.

Upvotes: 4

mipadi
mipadi

Reputation: 410662

goalNavigationController should be a property or an accessor in your UIViewController subclass.

Upvotes: 4

Related Questions