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(Retinaディスプレイなし)でうまく機能します。私の男は網膜の動作についてです。画像の位置が違う?CGRectMake に scaleFactor を使用する必要がありますか、または UIAlertview の位置は絶対的ですか?

4

2 に答える 2

1

アプリケーション リソースで、「bottle_w_40@2x」という名前の画像を提供します。Retina ディスプレイに関しては、これが主な懸念事項になります。長方形のサイズを変更する必要はありません。

于 2012-08-17T17:56:59.143 に答える
1

私が知る限り、そのコードは Retina ディスプレイで動作します。

これはシミュレーターでテストできます。シミュレーターの [Hardware] > [Device] メニューに移動し、[iPhone (Retina)] または [iPad (Retina)] を選択します。

于 2012-08-17T17:57:31.370 に答える