0
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];
}
但不知何故view
沒有加載。我在代碼中找不到錯誤。請幫助解決這個問題。提前致謝。
我不確定你是否可以這樣做。但我沒有那樣做。我做了另一個UIViewController類,並在其中播放視頻。 – rptwsthi
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 這是什麼需要? –
是否將一些視圖分配給aMoviePlayerViewController.view?無論是在代碼或筆尖? – vikingosegundo