Trouble with Switching views using a Button

Discussion in 'iOS Programming' started by Ricky429, Aug 11, 2011.

  1. Ricky429 macrumors newbie

    Jan 9, 2011
    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.

    - (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.
  2. jnoxx macrumors 65816


    Dec 29, 2010
    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.

Share This Page