我在這裏有我的應用程序,它支持iOS 5.1和更高版本。但是,如果低於iOS 6.x,我想隱藏相機按鈕。我怎樣才能做到這一點?這裏是我添加Camerabutton:我想在iOS 5.x中隱藏一個按鈕,但不是在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:無束:無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;
}
你爲什麼要這麼做?你有相機需要的一些6.x API嗎? – rmaddy 2013-05-11 02:01:14
我們只是實現了一個市場,這是一個webView的相機。僅在iOS 6中支持在webView中上傳圖片。因此,該按鈕在iOS 5.1.x中沒有意義 – 2013-05-11 02:10:25