ImagePicker类包含和UIImagePicker:
tx2
UICollectionView进入图像选择器:
if (!tx2.IsEnabled)
{
tx2.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
};
因为上面提到的错误,这不起作用,但我该怎么做?
答案 0 :(得分:2)
委托不能是AnyObject?
类型。它必须是protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>?
类型:
class ImagePicker {
let imagePicker = UIImagePickerController()
weak var delegate: protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>?
init(delegate: protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>?) {
self.delegate = delegate
}
....
}
您还应该将其设为weak
属性以避免保留周期。