Accessing properties of properties

Discussion in 'iOS Programming' started by luckylefty01, Jun 23, 2008.

  1. macrumors member

    Joined:
    Apr 8, 2008
    #1
    I've got something that kind of stumps me.

    In my iPhone app delegate I have this code, which works (accessing the view property of the UIViewController MainViewController):

    Code:
    MainViewController *mainViewController =
        (MainViewController*)rootViewController.mainViewController;
    MainView *mainView = (MainView *)[mainViewController view];

    What I originally wanted to do was:

    Code:
    MainView *mainView = rootViewController.mainViewController.view;
    
    which fails with an "error: accessing unknown 'view' component of a property."

    Can anybody enlighten me as to why?
     
  2. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #2
    Is your mainViewController property declared as being a MainViewController* ?
     
  3. macrumors regular

    Joined:
    Mar 27, 2008
    #3
    Have you tried:
    Code:
    MainView *mainView = [rootViewController.mainViewController view];
     
  4. thread starter macrumors member

    Joined:
    Apr 8, 2008
    #4
    *sigh*

    Thanks. In my app delegate I had imported the root view controller and the main view itself, but the main view controller had been left out.
     

Share This Page