我正在嘗試使用phonegap探索ipad開發。我現在的問題是,Phonegap-ipad應用程序 - 調整根據方向啓動圖像
我有四個不同的發射圖像不同的方向。當應用程序啓動時,正在顯示正確的啓動圖像片刻。在此之後,phonegap會嘗試加載一個帶有default.png的imageview並將其顯示直到webview被完全加載。問題在於這裏.. Imageview是基於當前方向自動旋轉的。所以如果當前的方向是LandscapeLeft,imageview會在顯示它之前嘗試旋轉default.png這不是我想要的,這就是爲什麼我有不同的啓動圖像。所以實際上,您將有一個landscapeleft.png,然後自動旋轉default.png才能看到webview。
所以我試圖改變這樣的phonegapdelegate(在的applicationDidFinishLaunching)
UIImage* image=nil;
if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight){
NSLog(@"In default5");
image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default5" ofType:@"png"]];
}
if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft){
NSLog(@"In default6");
image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default6" ofType:@"png"]];
}
if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown){
NSLog(@"In default7");
image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default7" ofType:@"png"]];
}
imageView = [[UIImageView alloc] initWithImage:image];
[image release];
它沒有工作和調試時我發現statusbarorientation總是肖像。這可能是因爲phonegap嘗試將肖像設置爲同一個applicationDidFinishLaunching方法中的狀態方向(在加載此圖像視圖之前)。
有人能告訴我如何以正確的圖像加載圖像視圖?