0

我正在开发一个应用程序,我在 UIAlertView 中显示一些图标以解释它们的使用。我这样做是使用:

UIAlertView *helpAlert = [[UIAlertView alloc] initWithTitle:@"The button:\n\n  is used to do... \n\n  " message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];

    UIImageView *imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(20, 55, 40, 40)]; 
    NSString *path1 = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath]   stringByAppendingPathComponent:@"bottle_w_40.png"]];
    UIImage *bkgImg1 = [[UIImage alloc] initWithContentsOfFile:path1];
    [imageView1 setImage:bkgImg1];
    [bkgImg1 release];
    [path1 release];

    [helpAlert addSubview:imageView1];
    [imageView1 release];
    [helpAlert show];
    [helpAlert release];

它在模拟器和我的 iphone 3gs(没有视网膜显示)中运行良好。我的伙计是关于视网膜行为的。图片位置会不一样吗?我是否需要为 CGRectMake 使用一些 scaleFactor 或 UIAlertview 中的位置是绝对的?

4

2 回答 2

1

在应用程序资源中,提供一个名为“bottle_w_40@2x”的图像,这将是视网膜显示时最需要担心的事情。矩形不需要调整大小。

于 2012-08-17T17:56:59.143 回答
1

据我所知,该代码将在视网膜显示器上运行。

您可以在模拟器中对此进行测试。转到模拟器的硬件 > 设备菜单并选择“iPhone (Retina)”或“iPad (Retina)”。

于 2012-08-17T17:57:31.370 回答