【问题标题】:How to add smiley on my alert view? [duplicate]如何在我的警报视图上添加笑脸? [复制]
【发布时间】:2012-05-23 05:49:02
【问题描述】:

可能重复:
Image in UIAlertView

我正在实现一个益智游戏。玩家获胜后,我会显示您获胜的警报。但是我想在我的警报视图上添加笑脸。该怎么做?

【问题讨论】:

    标签: iphone


    【解决方案1】:

    使用这个

    UIAlertView *successAlert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(220, 10, 40, 40)];
    
        NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"smile.png"]];
        UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path];
        [imageView setImage:bkgImg];
        [bkgImg release];
        [path release];
    
        [successAlert addSubview:imageView];
        [imageView release];
    
        [successAlert show];
        [successAlert release];
    

    复制表格here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-05
      • 1970-01-01
      • 2021-04-26
      • 1970-01-01
      • 2016-12-10
      • 1970-01-01
      相关资源
      最近更新 更多