我正在尝试调用我的shouldSelectViewController委托函数。但它似乎没有用。
我做了以下操作,但仍然没有调用函数
@interface myAppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
@implementation TakeFiveCameraAppDelegate
@synthesize window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
tabBarController.delegate = (id)self;
return YES;
}
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
NSLog(@"test");
return YES;
}
@end
我不确定我在这里失踪了什么。
答案 0 :(得分:0)
添加viewDidLoad
[self setDelegate:self];