开发者

Calling a UIApplicationDelegate method from a UIViewController

开发者 https://www.devze.com 2022-12-23 17:41 出处:网络
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.

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

精彩评论

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