對於以下代碼,我需要根據iphone和ipad方向設置不同的UIIMageView位置。CGRect爲不同的iphone ipad方向
// Animated images - centered on screen
animatedImages = [[UIImageView alloc] initWithFrame:CGRectMake(
(SCREEN_WIDTH/2) - (IMAGE_WIDTH/2),
(SCREEN_HEIGHT/2) - (IMAGE_HEIGHT/2) + STATUS_BAR_HEIGHT,
IMAGE_WIDTH, IMAGE_HEIGHT)];
由於CGRect將爲ipad肖像,iphone肖像,ipad風景和iphone風景不同。
如何做到這一點
if (Ipad Portrait orientation)
{
code with different position using CGRectMake (...............)
}
if (Iphone Portrait orientation)
{
code with different position using CGRectMake (...............)
}
if (Ipad Landscape orientation)
{
code with different position using CGRectMake (...............)
}
if (Iphone Landscape orientation)
{
code with different position using CGRectMake (...............)
}
請格式化您的文章,並使用代碼標籤,以便閱讀。 – EmilioPelaez