私は Apache Cordova アプリケーションを作成する Web 開発者であるため、Objective-C に関する知識はほとんどありません。スプラッシュ画面をビデオで補足しようとするまで、すべてがうまくいっています。それは一種のことですが、完全ではありません.. Default.png の表示から始まり、その後に SplashScreenLoader が続きます。次に、実際にビデオを再生します。オーディオが出力されるため、これはわかりますが、ビデオレイヤーは表示されません。
私が見つけたのは、self.window または self.viewController の両方が didFinishLaunchingWithOptions で定義されているため、 - (id) init メソッドには存在しないということです。したがって、ロードスプラッシュの上に配置する方法が見つかりません。
現在、私の init メソッドは AppDelegate.m で次のようになっています。
- (id) init {
NSString *moviePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Splash_v1.mp4"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: movieURL];
moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayer.view setFrame: self.window.bounds];
[self.window addSubview:moviePlayer.view];
[self.window makeKeyAndVisible];
[moviePlayer play];
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
[cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
[CDVURLProtocol registerURLProtocol];
return [super init];
}
ここで self.window は null です。また、次のコードで self.window を設定しようとしました。
CGRect screenBounds = [[UIScreen mainScreen] bounds];
self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
...勝てずに。実際には設定しますが、後続のコードでは実行したくありません。
だから私が疑問に思っているのは、didFinishLaunchingWithOptions が開始される前に、このビデオをスプラッシュのコンテンツの上にどのように配置するかということです。
前もって感謝します、//ピーター