簡體   English   中英

從相機拍攝照片后如何跳過“重新使用”選項

[英]How to skip 'retake and use' option after captureing photo from camera

在此處輸入圖片說明

從相機捕獲照片后如何跳過“重用和使用”選項,或者如何更改這些按鈕的字體和顏色。

我們使用了以下代碼

    self.gimgPicker = [[GKImagePicker alloc] init];
    self.gimgPicker.cropSize = CGSizeMake(310, 310);
    self.gimgPicker.delegate = self;
    self.gimgPicker.desiredSize = CGSizeMake(640, 640);
    imgPicker = [[UIImagePickerController alloc] init];
            // Set type to Photo Library if button at index is selected
            if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {

                self.gimgPicker.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
                [parentController presentModalViewController:self.gimgPicker.imagePickerController animated:YES];
}

此視圖由UIImagePickerController類的showCameraControls屬性提供給您

如果將其設置為“ NO ,則不會看到該屏幕,但必須提供攝像頭控件。

您的替代方法是使用AVFoundation ,它將為您提供外觀和性能上的充分靈活性。 盡管設置會花費更多時間,但從長遠來看,它會有所回報。

我用swizzle解決了這個問題,盡管有點hack ...

使用顯示,我知道快門按鈕的類名是CAMShutterButton,它是UIButton的子類

因此,我僅在將其加載到超級視圖時隱藏此按鈕,然后放置自定義快門按鈕以發送takePicture消息

好吧,因為我可以隱藏它,所以我實際上可以將目標操作添加到此按鈕或使用通知

記得在調用takePicture之前設置setShowsCameraControls來跳過重拍和使用

不帶快門按鈕的相機

那你就可以做任何你想做的事

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

關於什么?

imagepicker.allowsEditing =否

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM