Trouble with Switching views using a Button

Discussion in 'iPhone/iPad Programming' started by Ricky429, Aug 11, 2011.

  1. macrumors newbie

    #1
    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.
     
  2. macrumors 65816

    jnoxx

    #2
    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