UIAlertView *theAlert = [[[UIAlertViewalloc] initWithTitle:@"Atention"
message: @"I'm a Chinese!"
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Okay",nil] autorelease];
[theAlert show];
UIImage *theImage = [UIImageimageNamed:@"loveChina.png"];
theImage = [theImage stretchableImageWithLeftCapWidth:0topCapHeight:];
CGSize theSize = [theAlert frame].size;
UIGraphicsBeginImageContext(theSize);
[theImage drawInRect:CGRectMake(, , theSize.width-, theSize.height-)];// 这个地方的大小要自己调整,以适应 alertview 的背景颜色的大小。
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
theAlert.layer.contents = (id)[theImage CGImage];

更改AlertView背景的更多相关文章

  1. android:更改PagerTabStrip背景颜色,标题字体样式、颜色和图标,以及指示条的颜色

    1.更改PagerTabStrip背景颜色 我们直接在布局中设置background属性可以: <android.support.v4.view.ViewPager android:id=&qu ...

  2. 【JMeter4.0】之 “jdk1.8、JMeter4.0” 安装与配置以及JMeter永久汉化和更改界面背景、并附加附录:个人学习总结

    目录: 一.首先,需要安装.配置jdk 二.其次,安装.配置JMeter 三.JMeter汉化以及更改界面背景 四.附录:个人学习总结 一.首先,需要安装.配置jdk   返回目录 1.到官网下载1. ...

  3. js 定时更改div背景图片

    今天遇到一个业务场景,使用js将一个div标签的背景图片定时更换一下. 之前百度了几个,有css+js,也有css3的,不过css3的兼容有问题,之后同事提示,可以使用js直接来更换div的北京图片, ...

  4. [C#源码]自动更改桌面背景

    操作代码:ChangeDesktop.cs using System;using System.Collections.Generic;using System.ComponentModel;usin ...

  5. ios更改UITabBarController背景以及选中背景图片的方法

    一.背景图片  1.5.0以上版本     UIImage *image = [UIImage imageNamed:@"system_tabbar_bg.png"];     [ ...

  6. 更改Calendar背景图(使用系统映像选择器)

    最近提出的申请,主接口是一个历,网上有很多第三方的日历控件,有使用ImageView实现,有使用GridView实现,它的优点是控制的灵活性. 而我选择使用本机CalendarView,关于这个控件, ...

  7. Android更改popupmenu背景并显示图标

    似乎popupmenu是无法单独设置style的,好像是由context决定的,前几天需要设置style,找了很久才找一一个办法,似乎是通过 ContextThemeWrapper 包装一个 Cont ...

  8. Ios17个常用代码整理

    .判断邮箱格式是否正确的代码 //利用正则表达式验证 -(BOOL)isValidateEmail:(NSString *)email { NSString *emailRegex = @" ...

  9. iOS 常用代码块

    1.判断邮箱格式是否正确的代码: // 利用正则表达式验证 -( BOOL )isValidateEmail:( NSString  *)email {   NSString  *emailRegex ...

随机推荐

  1. GridVeiw 使用

    1. 因使用的是 Mongodb,因此要在 ActiveDataProvider 中指定 key 属性 2. 自定义表格中的按钮 'class' => 'yii\grid\ActionColum ...

  2. POJ 3254 Corn Fields(状压DP)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 13732   Accepted: 7216 Desc ...

  3. 移动端单页视图库,适用于制作移动Web touchbox

    ouchBox 原文:https://github.com/maxzhang/touchbox 移动端单页视图库,适用于制作移动专题 DEMO http://jsbin.com/vatuma/late ...

  4. svn搭建,很简单

    yum install subversion 2015年1月7日15:23:07 我测试的时间 系统是centos6.5 直接yum,centos是可以直接解决apr apr-util 依赖问题,如果 ...

  5. 新浪SAEStorage图片上传的demo和说明

    <?php if(isset($_POST[up])){ $s2 =new SaeStorage();//实例化 $name =$_FILES['myfile']['name'];//上传到服务 ...

  6. SSH+Oracle10G抛Disabling contextual LOB creation as createClob() m

    在使用Oracle10G时候,实体类使用了CLOB字段,结果抛了Disabling contextual LOB creation as createClob() method threw error ...

  7. A VNC server is already running as :1

    root@host:~# rm -f /tmp/.X1-lock root@host:~# rm -f /tmp/.X11-unix/X1 root@host:~# vncserver -geomet ...

  8. Web 软件测试 Checklist 应用系列,第 1 部分: 数据输入

    Web 软件测试 Checklist 应用系列,第 1 部分: 数据输入 本文为系列文章"Web 软件测试 Checklist 应用系列"中的第一篇.该系列文章旨在阐述 Check ...

  9. HTML: 用CSS畫一個三角形

    代碼如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  10. nginx服务器安装与启动

    nginx服务器介绍 1.nginx服务器功能 nginx服务器可以扮演:轻量级的web服务器.应用服务器.代理服务器.反向代理服务器.后台服务器.CDN缓存服务器 nginx的基本模块: 内核模块C ...