简体   繁体   中英

multiple delegates give warning

This is not a serious bug I'm just wondering because XCode is throwing me a warning when I'm trying to do 2 delegates from one view. my view interface declaration looks like this

@interface C4WorkSpace : C4CanvasController<UITextViewDelegate, UIImagePickerControllerDelegate>

and then I have a UIImagePicker that goes like this

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;

and a UITextViewDelegate like this

userNameField = [[UITextView alloc] initWithFrame:textViewFrame];
userNameField.delegate = self;

I'm rather new to delegates and basically all that code is made up by using code from somebody else so I'm not sure I completely understand the concepts of delegates.

The warning I get is: "Assigning to 'id' from incompatible type 'C4Workspace *const__strong'"

Is it that I need to delegate to something else then self? If so to what? Or is it a C4issue?

so the magic is just adding UINavigationControllerDelegate to the interface declaration. It looks like this then

@interface C4WorkSpace : C4CanvasController<UITextViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate>

thanks everyone for the help in the comments!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM