Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Ricky429

macrumors newbie
Original poster
Jan 9, 2011
4
0
I created a project using the View based app every time I add a second view and the code it doesnt seem to work at all.


Code:
- (IBAction)switchViews {
	
	MainView *firstView = [[MainView alloc] initWithNibName:@"MainView" bundle:[NSBundle mainBundle]];
	[self.view addSubview:firstView.view];
	[SecondViewController release];
}

Thats the code im using and i make the necessary connections but the error i keep getting is "request for member 'view' in something not a structure or union." The error happens on the self.view line.

What could this mean?
Also im using Xcode3.1.3 if that makes a difference.
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
Well, your error code is giving you kind of a hand on.
your self, doesn't have a view property, what is your "self", how do we know what your "self" is ;)
Because your code is correct. Just, I think you are thinking wrong in your flow.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.