我有我的应用程序,它支持 iOS 5.1 和更新版本。但是,我想在低于 iOS 6.x 时隐藏相机按钮。我怎样才能做到这一点?这是我添加相机按钮的方法:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
if ([viewController isKindOfClass:[ATWebViewController class]]) {
NSURL *url = nil;
if (viewController.tabBarItem.tag == 0) {
url = [NSURL URLWithString:@"http://----.de"];
}
else if (viewController.tabBarItem.tag == 1) {
url = [NSURL URLWithString:@"http://----.de"];
}
// 如果 viewController.tabBarItem.tag==0 ATWebViewController *webViewController = [[ATWebViewController alloc] initWithNibName:nil bundle:nil URL:url ];
UINavigationController *navigationBarController = [[UINavigationController alloc] initWithRootViewController:webViewController];
navigationBarController.navigationBar.tintColor = ATNavigationBarTintColor;
if (viewController.tabBarItem.tag == 0) {
webViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissWebView)];
webViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(TakePhoto)];
}
else if (viewController.tabBarItem.tag == 1) {
webViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissWebView)];
}
navigationBarController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:navigationBarController animated:YES];
return NO;
}
return YES;
}