iOS 4.0用のiOSアプリを開発しました。これはナビゲーションベースのアプリケーションでした。iPhone-5もサポートしたいです。デバイスのバージョンを確認した後、xibを変更したと思います。問題が発生しています。xibが変更されましたが、ビューの高さが変更されていません。 。他の誰かがこの問題に直面した場合にどのように可能になるか私とアイデアを共有してください。ありがとう。
2 に答える
1
APPデリゲート:-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
//----------------HERE WE SETUP FOR IPHONE 4/4s/iPod----------------------
if(iOSDeviceScreenSize.height == 480){
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_4inch" bundle:nil];
NSLog(@"iPhone 4: %f", iOSDeviceScreenSize.height);
}
//----------------HERE WE SETUP FOR IPHONE 5----------------------
if(iOSDeviceScreenSize.height == 568){
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_5inch" bundle:nil];
NSLog(@"iPhone 5: %f", iOSDeviceScreenSize.height);
}
return YES;
}
その作品!!!!!!
于 2013-04-09T06:10:00.153 に答える
0
iOS 6をベースSDKとして設定し、自動レイアウト機能を使用して、すべてのタイプの画面に合わせて拡大縮小できる画面を作成します。これを行うには、Xcode4.5が必要です。
ここで自動レイアウトを開始します:
http ://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
http://www.raywenderlich.com/20897/beginning-auto-layout- part-2-of-2
それでもiOS4.0をサポートしたい場合は、画面サイズごとに別々の.xibファイルを用意し、起動時に適切にロードします。
画面サイズに基づいて異なるnibファイルを読み込むには、アプリデリゲートで、次のコードを追加/置換する必要があります-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_4inch" bundle:nil];
} else {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
}
ここViewController_4inch
で、iPhone5画面用に設計されたnibファイルの名前です。
于 2012-12-10T07:11:23.627 に答える