开发者

Calling a UIApplicationDelegate method from a UIViewController

I have a simple iPhone application that is very similar to the Page Control example provided by Apple. It creates a group of UIViewControllers dynamically, then adds them to a ScrollView.

When a button is touched on one of these views, I need to be able to call a method back in the UIApplicationDelegate. It will then do some calculations, and generate a开发者_开发百科 new set of views to display.

I'm not sure how to make this happen. It would seem like this would work, but it doesn't:

[[self superview] doSomething];

What am I missing? Thanks.


[[(MyAppDelegate*)[UIApplication sharedApplication] delegate] doSomething]

Replace MyAppDelegate with the name of your App Delegate class

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜