zoukankan      html  css  js  c++  java
  • 更改AlertView背景

    UIAlertView *theAlert = [[[UIAlertViewalloc] initWithTitle:@"Atention"

                                                            message: @"I'm a Chinese!"

                                                           delegate:nil 

                                                  cancelButtonTitle:@"Cancel" 

                                                  otherButtonTitles:@"Okay",nil] autorelease];

        [theAlert show];

        UIImage *theImage = [UIImage imageNamed:@"loveChina.png"];    

        theImage = [theImage stretchableImageWithLeftCapWidth:0topCapHeight:0];

        CGSize theSize = [theAlert frame].size;

        

        UIGraphicsBeginImageContext(theSize);    

        [theImage drawInRect:CGRectMake(55, theSize.width-10, theSize.height-20)]; //这个地方的大小要自己调整,以适应alertview的背景颜色的大小。

        theImage = UIGraphicsGetImageFromCurrentImageContext();    

        UIGraphicsEndImageContext();

        theAlert.layer.contents = (id)[theImage CGImage];
    做一个顶天立地的男子,并且自信,健康微笑的生活下去!
  • 相关阅读:
    使用ParseExact方法将字符串转换为日期格式
    Windows 备用数据流(ADS)的妙用___转载
    ms17_010利用复现(32位)
    将手机号设置为空号
    PowerShell批量创建文件夹
    让程序显示运行时间
    使用Sleep方法延迟时间
    使用TimeSpan对象获取时间间隔
    DateTime小综合
    DDMS介绍
  • 原文地址:https://www.cnblogs.com/luoxiao1115/p/3041172.html
Copyright © 2011-2022 走看看