I have created a method in Appdelegate.m
-(void)setupTabBarController {
// details goes here
}
Now in ABC.m
I want to access the setupTabBarController
I have included app delegate:
#import "AppDelegate.h"
And then:
AppDelegate *maindelegate = [[AppDelegate alloc] init];
[maindelegate setupTabBarController];
But it's showing the error,
No visible @interface for 'Appdelegate' declares the selector 'setupTabBarController'
Where I am wrong?
As the error message states, you need to declare it in AppDelegate.h
and then you should call it as:
AppDelegate *maindelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[maindelegate setupTabBarController];
In AppDelegate.h:
@interface AppDelegate : UIResponder <UIApplicationDelegate>
- (void)setupTabBarController;
@end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With