![](/img/trans.png)
[英]How to disable/Hide the UIImagePickerController Camera shutter in iPhone app?
[英]UIImagePickerController: Detecting Camera button (shutter) pressed
我想調用一種方法,該方法在用戶按下相機快門后立即執行NSNotification(即,當“ Preview”標簽欄上有“ Retake”和“ Use”按鈕時)。
我不能使用didFinishPickingImage方法,因為此時用戶已經按下“使用”按鈕。
我已經通過UIImagePickerController的cameraOverlayView屬性實現了此功能(請參閱評論),但是我想知道是否存在更快的“觀察”此動作的方法。
有任何想法嗎?
要了解相機按鈕按下事件,您可以為其觸發NSNotification
。
// Add observer for when camera button is pressed
NSNotificationCenter.defaultCenter().addObserver(self, selector: @selector(yourFunctionToPerform), name: "_UIImagePickerControllerUserDidCaptureItem", object: nil)
ImagePickerViewController
以下方法添加到要創建ImagePickerViewController
的ViewController
中:
-(void) yourFunctionToPerform{
//Do what you want to do on Camera button tap event
}
我也在搜索此問題,該事件的鍵/名稱確實不清楚。
您可以在選擇圖像后顯示它。
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
//Display the UIAlertView
[alertView show];
//Just never use the image
}
如果您不想使用圖像,則不必
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.