'UINavigationControllerDelegate'에 해당되는 글 1건

 
  1. 2010.08.24 [iPhone/Xcode] 이미지피커 델리게이트 경고, UIImagePickerController delegate, Class does not implement the 'UINavigationControllerDelegate' protocol 1
2010. 8. 24. 02:00 ANDROID IOS
[iPhone/Xcode] 이미지피커 델리게이트 경고, UIImagePickerController delegate, Class does not implement the 'UINavigationControllerDelegate' protocol

-(IBAction)touchButtonBackground{

UIImagePickerController *imagePicker=[[UIImagePickerController alloc] init];

imagePicker.delegate=self;

imagePicker.allowsEditing=NO;

//picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

imagePicker.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;

[self presentModalViewController:imagePicker animated:YES];

[imagePicker release];

}


코드는 이미지피커에 사용되는 버튼 코드입니다.

UIImagePickerController는 선택한 이미지를 받아 처리할수 있는 델리게이트를 설정해야합니다.

당큰 대부분은 코드가 있는 현재클래스인 self를 사용하는데,

무심코 예제코드만 넣으면 경고가 뜹니다.


Class 'XXXXX' does not implement the 'UINavigationControllerDelegate' protocol


이거슨 델리게이트로 설정된 클래스에 UINavigationControllerDelegate가 정의되지 않았기때문입니다.

간단하게 클래스.h파일에 

UINavigationControllerDelegate를 추가해주면 경고는 사라집니다.


이미지 피커를 사용할때는 클래스 인터페이스에 UIImagePickerControllerDelegate와 UINavigationControllerDelegate를 정의하세요.

최근에 올라온 글

최근에 달린 댓글