对于以下代码,我需要根据 iphone 和 ipad 方向设置不同的 UIIMageView 位置。
// 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 (...............)
}