I';I’我想在iOS 5.x中隐藏一个按钮,但不想在iOS 6.x中隐藏

I';I’我想在iOS 5.x中隐藏一个按钮,但不想在iOS 6.x中隐藏,ios,objective-c,uibutton,Ios,Objective C,Uibutton,我这里有我的应用程序,它支持iOS 5.1和更新版本。但是,我想在低于iOS 6.x时隐藏摄像头按钮。我该怎么做?下面是我如何添加Camerabutton的: - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController { if ([viewController isKindOfClass:[ATWebVi

我这里有我的应用程序,它支持iOS 5.1和更新版本。但是,我想在低于iOS 6.x时隐藏摄像头按钮。我该怎么做?下面是我如何添加Camerabutton的:

- (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;

}

通常,最好通过检查类或方法的存在来检查特定功能。但在这种情况下,没有针对
UIWebView
的适当API检查

一种解决办法是:

if ([[[UIDevice currentDevice] systemVersion] hasPrefix:@"5"]) {
    // iOS 5.x
} else {
    // not iOS 5.x
}

通常,最好通过检查类或方法的存在来检查特定功能。但在这种情况下,没有针对
UIWebView
的适当API检查

一种解决办法是:

if ([[[UIDevice currentDevice] systemVersion] hasPrefix:@"5"]) {
    // iOS 5.x
} else {
    // not iOS 5.x
}

你为什么要这样做?有一些6.x API你需要的相机吗?我们只是实现了一个市场的相机,这是一个网络视图。仅iOS 6支持在网络视图中上载图片。因此,在iOS 5.1.x中,该按钮毫无意义。您为什么希望这样做?有一些6.x API你需要的相机吗?我们只是实现了一个市场的相机,这是一个网络视图。仅iOS 6支持在网络视图中上载图片。因此,在iOS 5.1.x中,该按钮没有任何意义非常感谢您。。。我知道我必须检查iOS版本,但尝试了SLComposeViewTypeFacebook的可用性。。。这个好得多……:)非常感谢你。。。我知道我必须检查iOS版本,但尝试了SLComposeViewTypeFacebook的可用性。。。这个好得多……:)