So i followed this tutorial on how to create a global function..
All is working except in my global function i have a line that is:
[self.view addSubview:gld];
and i am getting an error on self.view.. any ideas?
I need the self.view part to be the view that called the function..
The Error:
Property ‘view’ not found on object of type ‘GlobalData*’
The error you received means that the GlobalData doesn’t have a property called view. Instances thant inherit from the class UIViewController have a view property. So you must be sure that GlobalData inherits from UIViewController, or any other class that has a UIView property.
EDIT
Now I see what you mean – but now it’s clearer and you aren’t using the correct nomenclature. Your method, in GlobalData, should change to:
-(void)loadInfo:(UIView*)superView { [superView addSubview:superView]; }And then, you call it this way:
[[Globaldata sharedGlobalData] loadinfo:self.view];