UITabBarController的代理方法

-(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {

    if (viewController == self.viewControllers[3]) {

        picker = [[UIImagePickerController alloc]init];

        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

        [self presentViewController:picker animated:YES completion:nil];

        return NO;

    }

    return YES;

}

以上代码是判断选中的哪个item的方法,可以进行定制他们的动作。需要遵守UITabBarControllerDelegate

你可能感兴趣的:(controller)