[英]to correctly target delegate if I don't want to create instance and setting delegate in viewDidLoad() but in some method?
如果我不想在viewDidLoad()中創建實例並在某種方法中設置委托,如何正確定位委托? 一切正常,但收到警告。
// ViewController.m
// Warning: Assigning to 'id'<UINavigationControllerDelegate,UIImagePickerControllerDelegate> from incomplatible type 'ViewController *const __strong
-(void)takeMedia:(UIButton *)sender
{
mypicker = [UIImagePickerController new];
mypicker.delegate = self; // <<<----
mypicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:mypicker animated:YES completion:nil];
}
確保您在頭文件中都包含了兩個委托,例如
@interface MyViewController <UINavigationControllerDelegate,UIImagePickerControllerDelegate>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.