2011-08-09 11 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内で設定できます。

+0

は意味があります...また、コードをコピーして貼り付けるためにも私の役目を果たします。 :バツ – Mytheral