2011-05-12 6 views
2

두 가지보기가 있습니다. 첫 번째 : FirstViewController 두 번째 : SecondViewControllerUIPickerView로 인해 응용 프로그램이 충돌 함

FirstView 컨트롤러는 내 UINavigationController의 루트 컨트롤러이며 그 안에 테이블이 있습니다. 셀을 클릭하면보기가 SecondViewController로 이동합니다. SecondViewController에서 UIPickerView를 넣으려고합니다. SecondViewController.h에서

, 나는이 : SecondViewController.m에서

@interface SearchOptionController : UIViewController { 

    IBOutlet UIPickerView *pickerView; 
    NSMutableArray *optionArray; 

} 


@property (nonatomic, retain) IBOutlet UIPickerView *pickerView; 
@property (nonatomic, retain) NSMutableArray *optionArray; 

@end 

는 내가 가지고 :

@synthesize pickerView; 

모든 pickerview 방법.

인터페이스 작성기에서 UIPickerView를 추가하고 대리인 및 데이터 원본에 대해 파일 소유자를 선택했습니다. 의 viewDidLoad 방법은 SecondViewController 끝나는 때 응용 프로그램이 충돌의 말 : 내가 방지하기 위해 어떻게해야하고 무엇

int main(int argc, char *argv[]) 
{ 
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
    int retVal = UIApplicationMain(argc, argv, nil, nil); 
    [pool release]; 
    return retVal; 
} 

:의 두 번째 줄에 SIGABRT

:

프로그램이 신호를받은 이 충돌로 uipickerview로 뷰를로드 할 수 있습니까?

편집 : 나는 인터페이스 빌더에서 UIPickerView를 제거하면

는 응용 프로그램이 제대로 실행됩니다. UIView 내부에 UIPickerView를 배치하는 데 문제가있는 것 같지만, 처리 할 수 ​​없습니다. 초보자가 어렵습니다.

+0

응용 프로그램이 충돌 할 때 일반적으로 콘솔에 오류 설명이 표시됩니다. 무엇입니까? – Vladimir

+0

피커의 대리자 메서드를 구현 했습니까? – dks1725

+0

2011-05-12 16 : 04 : 55.108 Senior5 [1006 : 207] - [SearchOptionController numberOfComponentsInPickerView :] : 인스턴스로 전송 된 인식 할 수없는 선택 자 0x4e33410 2011-05-12 16 : 04 : 55.110 Senior5 [1006 : 207] *** 때문에 캐치되지 않는 예외 'NSInvalidArgumentException'이유 응용 프로그램 종료 '- [SearchOptionController numberOfComponentsInPickerView :] : 미정 선택기 인스턴스 0x4e33410 전송' – aeciftci

답변

2

이 개체에 대한 대리자 메서드를 구현했는지 확인해야합니다.

관련 문제