开发者

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];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜