簡體   English   中英

以異步方式從UIViewController調用方法presentViewController

[英]Calling method presentViewController from the UIViewController in an asynchronous way

是否有任何機制以異步方式調用presentViewController方法?

UIImagePickerController *imagePicker = [[UIImagePickerController alloc]init];
imagePicker.delegate = self;
imagePicker.sourceType  = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = @[(NSString *) kUTTypeImage];
imagePicker.allowsEditing = NO;
[self.viewController presentViewController:imagePicker animated:YES completion:nil];

不,這是設計使之同步的。 但是您可以啟動另一個線程,然后在該線程中執行同步調用。 但是我不會那樣做。

UI方法必須在主線程上運行,因此無法以異步方式調用它

暫無
暫無

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

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