views:

46

answers:

3

Hi!

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!

+1  A: 

Add the method signature to your AppDelegate's .h file and import that file in those .m files that you call it from.

Eiko
+3  A: 

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)

hotpaw2
A: 

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];
...
alones