0

UIAlert ビルダーがあり、タイトルとボタンの間に画像を追加したいと考えています。これは私のコードです:

UIAlertView *pull = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"pull_wire", nil)
                                    message:nil
                                    delegate:nil
                                    cancelButtonTitle:NSLocalizedString(@"continue_text", nil)
                                    otherButtonTitles:nil];

UIImageView *imageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"cable.png"]];

[pull addSubview:imageView];
[pull show];

ただし、画像は UIAlertView の上に表示されます。

@yunas ソリューションを使用:

ここに画像の説明を入力

画像が大きすぎるのではないでしょうか?

画像のサイズ変更:

ここに画像の説明を入力

どうすればUIAlert内で取得できますか?

4

2 に答える 2

2
UIAlertView *pull = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"pull_wire", nil)
                                message:@"\n\n\n\n\n\n\n\n\n\n\n\n"
                                delegate:nil
                                cancelButtonTitle:NSLocalizedString(@"continue_text", nil)
                                otherButtonTitles:nil];
于 2013-04-08T08:19:40.183 に答える
1
UIAlertView *pull = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"pull_wire", nil)
                                    message:nil
                                    delegate:nil
                                    cancelButtonTitle:NSLocalizedString(@"continue_text", nil)
                                    otherButtonTitles:nil];

[pull show];

UIImageView *imageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"cable.png"]];
    CGRect frame = imageView.frame;
    frame.origin = CGPointMake(0, 80); // set the origin here
    frame.size = CGSizeMake(90,40);//ANY SIZE that you want, but remember if you want the alertview to be big in size you need to apply transformation on the pull (ALERTVIEW)
[imageView setFrame:frame];
[pull addSubview:imageView];
于 2013-04-08T08:42:10.550 に答える