按信标设备点击捕获照片

时间:2017-08-01 12:37:04

标签: ios objective-c xcode8.2

我是iOS开发的新手。我正在开发一个应用程序,用户可以通过单击信标设备按钮打开相机。我还想通过点击信标设备而不是相机默认控件来拍照。 如何使用信标设备。这是开放式摄像机的代码但无法通过按下信标设备点击来捕捉照片

- (void)doublePressNotify:(NSNotification *)notification {
    CBPeripheral *peripheral = notification.object;
    AXATag *tag = [self findAXATag:peripheral.identifier.UUIDString];
    tag.pressType = @"double press";
    tag.beaconuuid = peripheral.identifier.UUIDString;
    NSLog(@"Shaheryar: %@", tag.beaconuuid);
    if([tag.beaconuuid  isEqual: @"B5F38CEB-C002-4A35-95BE-031F756131C4"]) {

        if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {

            UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Device has no camera" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
            [myAlertView show];

        } else {

            UIImagePickerController *picker = [[UIImagePickerController alloc] init];
            picker.delegate = self;
            picker.allowsEditing = YES;
            picker.sourceType = UIImagePickerControllerSourceTypeCamera;

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

        }

    }
}

0 个答案:

没有答案