• 更改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];
    做一个顶天立地的男子,并且自信,健康微笑的生活下去!
  • 相关阅读:
    【老生常谈】Attr与Prop的区别
    【NodeJs】入门笔记一
    absolute的left和right的妙用
    文本框选中文字却不出现蓝色选中状态
    Ajax
    Canvas 与 SVG 的区别
    如何学好英语
    xCode6中SizeClass的使用
    CocoaPods安装和使用教程
    Unity3D教程宝典之Shader篇:特别讲 CG函数
  • 原文地址:https://www.cnblogs.com/luoxiao1115/p/3041172.html
Copyright © 2020-2023  润新知