• 更改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];
    做一个顶天立地的男子,并且自信,健康微笑的生活下去!
  • 相关阅读:
    array方法(一)
    浅谈开发中所注意的问题
    缩略图初版
    Finite State Machine
    mMathf -》 Unity3d通用脚本
    Follow Path -》 Unity3d通用脚本
    Google 网站打不开
    MonoBehaviour.StopCoroutine
    Tutorial Unity 4 apk splitting into OBB for google play
    NGUI List<EventDelegate> 小坑
  • 原文地址:https://www.cnblogs.com/luoxiao1115/p/3041172.html
Copyright © 2020-2023  润新知