How to call a method in one class from another class
i have insertintodatabase{}
metho开发者_如何学编程d in sqAppDelegate
file.
Now , I want to call this method from my rootViewcontroller.m class. How can i do this.
Thanks in advance.
Use the below code to access your sqAppDelegate object ...
Put the below code in any function of your RootViewController
where you want to invoke sqAppDelegate
method ...
Let's suppose, tha function name is myRootViewControllerFunctionToInvokeDelegateMethod
-(void) myRootViewControllerFunctionToInvokeDelegateMethod
{
sqAppDelegate* mydel = (sqAppDelegate*) [[UIApplication sharedApplication] delegate];
//And then invoke the function ....
[mydel insertintodatabase];
}
精彩评论