Reputation: 2343
i've implemented a transition methood in my app delegate file and from every where in the code i want to call it in order to make nice and cool transitions. i call her like that
[[[UIApplication sharedApplication] delegate] transFromMainToGalery];
for example.
the problem is that im getting warning which is ok (cause it already got approved by apple) but i still want to fix it
the error:
'-transFromMainToGalery' not found in the protocol
any ideas??
thanks in advance!
Upvotes: 1
Views: 1235
Reputation: 2904
How about using UIApplication instead of UIApplicationDelegate.
@interface UIApplication (My)
-(void)myFunc;
@end
Implementing and calling are as below,
@implementation UIApplication (My)
-(void)myFunc {
}
...
[[UIApplication sharedApplication] myFunc];
...
Upvotes: 0
Reputation: 70733
In your myAppDelegate.h file, make sure you have:
- (void) transFromMainToGalery;
Then cast the generic app delegate returned by the sharedApplication delegate to your specific app delegate class:
[ (myAppDelegate *)[[UIApplication sharedApplication] delegate] transFromMainToGalery ];
Also include myAppDelegate.h in the header of your various other classes which use this message.
(substitute your app delegate class and file name for "myAppDelegate" as needed)
Upvotes: 4
Reputation: 25632
Add the method signature to your AppDelegate's .h file and import that file in those .m files that you call it from.
Upvotes: 1