开发者

iOS - Crashing Custom View

开发者 https://www.devze.com 2023-03-26 15:25 出处:网络
The Project is Crashing with this error. 2011-08-08 19:34:27.539 MCIT[12233:207] -[TrailersViewController initWithFrame:]: unrecognized selector sent to instance 0x58396e0

The Project is Crashing with this error.

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'

in this method on the delegate

-(void)switchToTrailerOne
{   
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    CGRect screenBounds = CGRectMake(0, 0, screenSize.width, screenSize.height);
    TrailersViewController *trailersController = [[TrailersViewCont开发者_如何学Goroller alloc] initWithFrame:screenBounds];

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

Questions are welcomed, but if you'd like to see the code the offending view controller files are here.

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


You are trying to initWithFrame on a UIViewController. You will use initWithFrame on UIView subclasses. The error you are getting is correct because UIViewController won't respond to that message because it doesn't have an initWithFrame selector. You can set the UIViewController's view property frame within the UIViewController.

0

精彩评论

暂无评论...
验证码 换一张
取 消