2011-08-09 4 views
0

프로젝트가이 오류로 인해 충돌합니다. 대리인이 메서드에서 iOS - 맞춤 설정 오류보기

2011-08-08 19:34:27.539 MCIT[12233:207] -[TrailersViewController initWithFrame:]: unrecognized selector sent to instance 0x58396e0 
2011-08-08 19:34:27.542 MCIT[12233:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TrailersViewController initWithFrame:]: unrecognized selector sent to instance 0x58396e0' 

-(void)switchToTrailerOne 
{ 
    CGSize screenSize = [UIScreen mainScreen].bounds.size; 
    CGRect screenBounds = CGRectMake(0, 0, screenSize.width, screenSize.height); 
    TrailersViewController *trailersController = [[TrailersViewController alloc] initWithFrame:screenBounds]; 

    [self.navController pushViewController:trailersController animated:NO]; 
    [trailersController goToFirstTrailer]; 
} 

질문은 환영하지만, 코드를보고 싶은 경우에 문제가되는 뷰 컨트롤러 파일이 여기에 있습니다.

http://mytheral.com/TrailersViewControllerH.html 
http://mytheral.com/TrailersViewControllerM.html 

답변

2

UIViewController에서 initWithFrame을 사용하려고합니다. UIView 하위 클래스에서는 initWithFrame을 사용합니다. UIViewController는 initWithFrame 선택기가 없기 때문에 해당 메시지에 응답하지 않으므로 가져 오는 오류는 정확합니다. UIViewController 내에서 UIViewController의 view 속성 프레임을 설정할 수 있습니다.

+0

... 또한 코드 복사 및 붙여 넣기에 적합합니다. :엑스 – Mytheral