0

如果我不想在 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];
}
4

1 回答 1

1

确保您已将两个代表都包含在头文件中,例如

@interface MyViewController <UINavigationControllerDelegate,UIImagePickerControllerDelegate>
于 2013-01-29T21:43:30.153 回答