0

ユニバーサル アプリでは、プロジェクト内のすべての画像に対して image.png、image@2x.png、image~ipad.png、および image@2x~ipad.png が必要ですか?

それとも、幅の広い iPad 画像を使用し、iOS でそれらを iPhone に縮小する必要がありますか?

画像が多いのでファイルサイズが少し気になります…

ありがとう!

4

1 に答える 1

0

必ずしもそうではありませんが、以下のコードを見ることができます。低解像度の iPad と低解像度の iPhone をターゲットにしている場合は、それぞれに 1 つのアイコン セットがあります。したがって、アイコンのセットにもある iPad の網膜と iPhone の網膜をターゲットにしている場合、car.png と car@2x.png という名前の画像がある場合、言及されている 4 つのモデルすべてをカバーする 2 つのアイコンがあります。

もちろん、画面がロジックよりも大きいため、iPad固有の画像を表示することも、デバイスのイディオムに応じて表示することもできます..以下のように

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {

//Device is iPhone
//This would give you low res icon for iPhone and if device is retina system will show it
UIImage *car = [UIImage imageNamed: @"Car.png"];
UIImageView *carImage = [[UIImageView alloc]initWithImage:car];

}

else {
//Device is iPad
//This would give you low res icon for iPad and if device is retina system will show it
UIImage *carLarge = [UIImage imageNamed: @"CarLarge.png"];
UIImageView *carImage = [[UIImageView alloc]initWithImage:carLarge];

}
于 2013-05-08T20:18:27.817 に答える