MoviePlayerAppDelegate.m
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
viewController = [[MoviePlayerViewController alloc] init];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
MoviePlayerViewController.m
-(void)loadView {
//Setup the view.
[self setView:[[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]];
[[self view] setBackgroundColor:[UIColor grayColor]];
[[self view] setUserInteractionEnabled:YES];
//Add play button.
playButton = [[UIButton alloc] initWithFrame:CGRectMake(53, 212, 214, 36)];
[playButton setBackgroundImage:[UIImage imageNamed:@"playButton.png"] forState:UIControlStateNormal];
[playButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[[self view] addSubview:playButton];
}
But somehow view is not loading. I could not find mistake in code. Please help to resolve this. Thanks in advance.
Try this:
Remove the code
and change addSubView as below.