tags:

views:

112

answers:

1
//root controller
class subviewcontroller;
@rootviewcontroller:UIViewController
{
   NSInteger a;
}

call a in subviewcontroller super.a=1;

system reported:

error:Request for member ‘a' in something not a structure or union

welcome any comment

interdev

A: 

You nee to make it a property and synthesize it. like:

In the header file

@property(nonatomic, assign)  NSInteger a;

and in the implementation file:

@synthesize a;

Hope this helps. Thanks

Madhup

Madhup
I did as aboveIt reported:error:request for member 'bChanged' in something not a structure or union
sorry, it iserror: request for member 'a' in something not a structure or union
this is because you are accessing it via super which will look for 'a' into UiViewController class not into your rootviewcontroller class. If you want to set the value of a variable of rootviewcontroller you must get the reference of that.
Madhup
SwitchViewController *rootController= [self.navigationController.viewControllers objectAtIndex:1]; rootController.bChanged =self.subChanged ; I used above codes to set the value from subchanged in subviewcontroller to the variable in root viewcontroller.But if I set the breakpoint, I checkled the value of rootController.bChangedhas not changed.Thanksinterdev
SwitchViewController *rootController= [self.navigationController.viewControllers objectAtIndex:0]; samething
Can you please check on going back to that screen , that the value of that object is getting changed or not, Note that you must be sure that index you are taking is correct.
Madhup