<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_一他糊涂</title><subtitle type="text">擅长技术，但不限于技术</subtitle><id>http://feed.cnblogs.com/blog/u/18372/rss</id><updated>2012-01-18T05:40:05Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/18372/rss"/><entry><id>http://www.cnblogs.com/jacktu/archive/2012/01/18/2325464.html</id><title type="text">会说话的TOM猫的原理是什么</title><summary type="text">很多网友对会说话的TOM猫的原理比较感兴趣，这里Android123就实现做一个简单的分析: 1. 音频采集 这点主要是通过Android设备的麦克风实时采集音频，由于Android平台的MediaRecorder类录制音频到文件，虽然可以通过空设备回调获得实时的音频流，不过为了降低开发者的难度，Android开发网推荐使用正统的AudioRecord和AudioTrack，首先我们仍然需要加入android.permission.RECORD_AUDIO这个权限。 android.media.AudioRecord类的read方法主要有3种重载形式:int read(short[] audi</summary><published>2012-01-18T05:40:00Z</published><updated>2012-01-18T05:40:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2012/01/18/2325464.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2012/01/18/2325464.html"/><content type="html">&lt;div&gt;&lt;p&gt;很多网友对会说话的TOM猫的原理比较感兴趣，这里Android123就实现做一个简单的分析:&lt;/p&gt;&lt;p&gt;&amp;nbsp; 1. 音频采集&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; 这点主要是通过Android设备的麦克风实时采集音频，由于Android平台的MediaRecorder类录制音频到文件，虽然可以通过空设备回调获得实时的音频流，不过为了降低开发者的难度，Android开发网推荐使用正统的AudioRecord和AudioTrack，首先我们仍然需要加入android.permission.RECORD_AUDIO这个权限。&lt;/p&gt;&lt;p&gt;&amp;nbsp; android.media.AudioRecord类的read方法主要有3种重载形式:&lt;/p&gt;&lt;p&gt;int&amp;nbsp; read(short[] audioData, int offsetInShorts, int sizeInShorts)&amp;nbsp;&amp;nbsp; //short在java中占用两个字节&lt;br /&gt;int&amp;nbsp; read(byte[] audioData, int offsetInBytes, int sizeInBytes)&amp;nbsp; //byte在java中占用一个字节&lt;br /&gt;int&amp;nbsp; read(ByteBuffer audioBuffer, int sizeInBytes)&amp;nbsp; //基于NIO的ByteBuffer类型&lt;/p&gt;&lt;p&gt;&amp;nbsp; 我们可以看到从麦克风中获取的音频无需经过文件系统直接通过AudioRecord类的read方法读入到我们预定的缓冲区中，这里需要注意的是采样率的大小必须有足够的缓冲区空间处理、&lt;/p&gt;&lt;p&gt;&amp;nbsp; 2. 变声处理&lt;/p&gt;&lt;p&gt;&amp;nbsp; 这点需要一些基本的音频处理方式，比如移调、变速，Android开发网推荐大家参考Adobe Audition的早期Cool Editi泄露的代码，当然音频处理算法比较多，大家可以自己实现。&lt;/p&gt;&lt;p&gt;&amp;nbsp; 3. 播放原始音频流&lt;/p&gt;&lt;p&gt;&amp;nbsp; 同样，处理完后考虑到效率我们仍然直接从内存流中播放，最简单的就是AudioTrack类，通过android.media.AudioTrack类的write方法，让Android声卡播放原始音频流。两种重载方法如下&lt;/p&gt;&lt;p&gt;int&amp;nbsp; write(short[] audioData, int offsetInShorts, int sizeInShorts)&amp;nbsp;&lt;br /&gt;int&amp;nbsp; write(byte[] audioData, int offsetInBytes, int sizeInBytes)&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2325464.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2012/01/18/2325464.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2012/01/10/2317978.html</id><title type="text">android GC</title><summary type="text">GC_FOR_MALLOC means that the GC was triggered because there wasn't enough memory left on the heap to perform an allocation. Might be triggered when new objects are being created.GC_EXPLICIT means that the garbage collector has been explicitly asked to collect, instead of being triggered by high </summary><published>2012-01-10T04:09:00Z</published><updated>2012-01-10T04:09:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2012/01/10/2317978.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2012/01/10/2317978.html"/><content type="html">&lt;div&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;GC_FOR_MALLOC means that the GC was triggered because there wasn't enough memory left on the heap to perform an allocation. Might be triggered when new objects are being created.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;GC_EXPLICIT means that the garbage collector has been explicitly asked to collect, instead of being triggered by high water marks in the heap. Happens all over the place, but most likely when a thread is being killed or when a binder communication is taken down.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;There are a few others as well:&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;GC_CONCURRENT Triggered when the heap has reached a certain amount of objects to collect.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;GC_EXTERNAL_ALLOC means that the the VM is trying to reduce the amount of memory used for collectable objects, to make room for more non-collectable.&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;typedefenum{&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Not enough space for an "ordinary" Object to be allocated. */&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GC_FOR_MALLOC,&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Automatic GC triggered by exceeding a heap occupancy threshold. */&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GC_CONCURRENT,&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Explicit GC via Runtime.gc(), VMRuntime.gc(), or SIGUSR1. */&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GC_EXPLICIT,&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* GC to try to reduce heap footprint to allow more non-GC'ed memory. */&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GC_EXTERNAL_ALLOC,&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* GC to dump heap contents to a file, only used under WITH_HPROF */&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GC_HPROF_DUMP_HEAP&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;}GcReason;&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;GC_EXTERNAL_ALLOC freed 297K, 49% free 3411K/6663K, external 24870K/26260K, paused 83ms&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;前面Free的内存是VM中java使用的内存，external是指VM中通过JNI中Native的类中的malloc分配出的内存，例如Bitmap和一些Cursor都是这么分配的。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;在Davilk中，给一个程序分配的内存根据机型厂商的不同，而不同，现在的大部分的是32M了，而在VM内部会把这些内存分成java使用的内存和 Native使用的内存，它们之间是不能共享的，就是说当你的Native内存用完了，现在Java又有空闲的内存，这时Native会重新像VM申请，而不是直接使用java的。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;例如上边的例子&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;free 3411K/6663K和external 24870K/26260K&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;如果这时需要创建一个2M的Bitmap，Native现有内存26260-24870=1390K&amp;lt;2048k,因此他就会向Vm申请内存，虽然java空闲的内存是&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;6663-3411=3252&amp;gt;2048,但这部分内存Native是不能使用。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;但是你现在去申请2M的Native内存，VM会告诉你无法分配的，因为现在已使用的内存已经接近峰值了32M(26260+6663=32923 )，所以现在就会成force close 报OOM。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;所以现在我们要检查我们的native内存的使用情况来避免OOM。&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;别的资料：&lt;/span&gt;&lt;a href="http://stackoverflow.com/questions/4525743/what-are-the-paused-values-in-gc-concurrent-log-messages" target="_blank" style="color: #108ac6; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;http://stackoverflow.com/questions/4525743/what-are-the-paused-values-in-gc-concurrent-log-messages&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2317978.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2012/01/10/2317978.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2012/01/04/2311878.html</id><title type="text">【转】Android 3.1 r1 API中文文档（6）——ImageView</title><summary type="text">结构继承关系public classView.OnClickListner extendsViewjava.lang.Objectandroid.view.Viewandroid.widget.ImageView直接子类ImageButton, QuickContactBadge间接子类ZoomButton类概述显示任意图像，例如图标。ImageView类可以加载各种来源的图片（如资源或图片库），需要计算图像的尺寸，比便它可以在其他布局中使用，并提供例如缩放和着色（渲染）各种显示选项。嵌套类enum ImageView.ScaleType将图片边界缩放，以适应视图边界时的可选项XML属性属性.</summary><published>2012-01-04T05:09:00Z</published><updated>2012-01-04T05:09:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2012/01/04/2311878.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2012/01/04/2311878.html"/><content type="html">&lt;div&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;结构&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;继承关系&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 21pt; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;em&gt;public class&amp;nbsp;&lt;span style="color: #c00000; "&gt;View.OnClickListner extends&amp;nbsp;View&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 42pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;java.lang.Object&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 42pt; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;android.view.View&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 63pt; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;android.widget.ImageView&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;直接子类&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 21pt; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;ImageButton, QuickContactBadge&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;间接子类&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 21pt; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;ZoomButton&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;类概述&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;显示任意图像，例如图标。&lt;/span&gt;ImageView&lt;span style="font-family: 宋体; "&gt;类可以加载各种来源的图片（如资源或图片库），需要计算图像的尺寸，比便它可以在其他布局中使用，并提供例如缩放和着色（渲染）各种显示选项。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;嵌套类&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;enum &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ImageView.ScaleType&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;将图片边界缩放，以适应视图边界时的可选项&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; "&gt;XML&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: 26.7pt; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-collapse: collapse; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; background-color: #ffffff; border-width: initial; border-color: initial; "&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" width="189" style="font-size: 12px; color: #454545; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #dee8f1; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;span style="font-family: 宋体; "&gt;属性名称&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="321" style="font-size: 12px; color: #454545; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #dee8f1; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;span style="font-family: 宋体; "&gt;描述&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 52.85pt; "&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; height: 52.85pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:adjustViewBounds&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; height: 52.85pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;设置该属性为真可以在&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;调整边界时保持图片的纵横比例。（译者注：需要与&lt;/span&gt;maxWidth&lt;span style="font-family: 宋体; "&gt;、&lt;/span&gt;MaxHeight&lt;span style="font-family: 宋体; "&gt;一起使用，否则单独使用没有效果。）&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:baseline&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;视图内基线的偏移量&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:baselineAlignBottom&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;如果为&lt;/span&gt;true&lt;span style="font-family: 宋体; "&gt;，图像视图将基线与父控件底部边缘对齐。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:cropToPadding&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;如果为真，会剪切图片以适应内边距的大小。（译者注：是否截取指定区域用空白代替。单独设置无效果，需要与&lt;/span&gt;scrollY&lt;span style="font-family: 宋体; "&gt;一起使用，效果如下，实现代码见代码部分：&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img alt="" src="http://images.cnblogs.com/cnblogs_com/over140/2010/9/2010-9-17_2.jpg" height="80" width="153" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;）&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:maxHeight&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;为视图提供最大高度的可选参数。（译者注：单独使用无效，需要与&lt;/span&gt;setAdjustViewBounds&lt;span style="font-family: 宋体; "&gt;一起使用。如果想设置图片固定大小，又想保持图片宽高比，需要如下设置：&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; margin-left: 18pt; text-indent: -18pt; text-align: left; "&gt;1）&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;设置&lt;/span&gt;setAdjustViewBounds&lt;span style="font-family: 宋体; "&gt;为&lt;/span&gt;true&lt;span style="font-family: 宋体; "&gt;；&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; margin-left: 18pt; text-indent: -18pt; text-align: left; "&gt;2）&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;设置&lt;/span&gt;maxWidth&lt;span style="font-family: 宋体; "&gt;、&lt;/span&gt;MaxHeight&lt;span style="font-family: 宋体; "&gt;；&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; margin-left: 18pt; text-indent: -18pt; text-align: left; "&gt;3）&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;设置设置&lt;/span&gt;layout_width&lt;span style="font-family: 宋体; "&gt;和&lt;/span&gt;layout_height&lt;span style="font-family: 宋体; "&gt;为&lt;/span&gt;wrap_content&lt;span style="font-family: 宋体; "&gt;。）&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:maxWidth&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;为视图提供最大宽度的可选参数。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="height: 180.3pt; "&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; height: 180.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:scaleType&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; height: 180.3pt; "&gt;&lt;p&gt;&lt;span style="line-height: 21px; font-size: 10.5pt; "&gt;控制为了使图片适合&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 21px; font-size: 10.5pt; font-family: Calibri, sans-serif; "&gt;ImageView&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 21px; font-size: 10.5pt; "&gt;的大小，应该如何变更图片大小或移动图片。一定是下列常量之一：&lt;/span&gt;&lt;/p&gt;&lt;table border="1" cellpadding="0" cellspacing="0" style="margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-collapse: collapse; border-width: initial; border-color: initial; "&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: black; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;span style="font-family: 宋体; "&gt;常量&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: black; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;span style="font-family: 宋体; "&gt;值&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: black; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;描述&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;matrix&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;0&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;用矩阵来绘图&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;fitXY&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;1&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;拉伸图片（不按比例）以填充&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的宽高&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="data:image/png;base64,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" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;fitStart&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;2&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;按比例拉伸图片，拉伸后图片的高度为&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的高度，且显示在&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的左边&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAeCAIAAABoq03CAAAE9klEQVRoge2asWsbSRSHt0jhIn+AiyvOkELqTuAihjQWpLjAFTGkiMCFWVwY4SIsLsySxiwqzKDCLC7M4sIwKgSjQjAuBKNGMCoEo2LhqVgYFSpeoWIKFVOo2CtGUZT4kC93l6v24zWCrT49fu/tk7zc835SFXxDIfp/Ivc88WqPl8quCtE/CyiVw89h/bzun/j+iV878WsnPt2vmBeeK1uI/k+gbSZ6Qs+0HEnaplGTBJehf1Z3xmvHPnlbJYdV8qZKDqvksGp2dgrR/wR+TeRIqVSxDtMzjXOEDNRY8Z6gLUpu4vAqrH8K/LO6f+r7p37tpFY7/r78D7WnX0DBN2CpzLoc5wgT0FNNmiRqRKRJ6APlPQ4Z2IU1C6NnWqVKDCTvctqi8V1MmiS6ioLLsH5Wr32syd3dQvQ2sFSmbSaHEiYAmdYzracaUpBDyTrMVXwXsy7LN7DW8hbTF4G+CESD1E78QvQzYKnMeyLPc7u0eZ4bY2ACoi/EQKixQkTrWH4t97B8oOY8sMbAsV//VC9EPwOWyvyRwwSS+4T3uM70WqVZGDSIiHqGkGk1UWqk5FDKoZRjRVtUfQr0WSDPg+AyLEQ/A5bKtE3zPMc5yqGkLRrfxnqq+SNXqUJEY4wxxtqV/XyZW2txjpBpmIAcSdblwWVw9P6oEL0NLJWTB4qIrMsQcZUP1roM0VPNuozcENIkpElom/IelyOppxrnxj2pZzq4CKpvq4XobWCpnNwniChHkrUZbVHapmIgVu28MK6RrbWI6FpY9AXvctqmtEVZh2nEqBFV9iuF6G3knseuCSLqqXZDL89zyIA/ctIkyX0i+oJ1mBgIPdV2Ya21+XKl3oFzEzai8m+F6K3knkevCWQgBzJ5SNxIhAxWa9xytUTDBORQir4wxmxadnkdXoWV1weF6G3knpc0IpiA06pnWgwEfaDJfQIT4D0OKeipXk3FhbFPwDlGDVJExzPknpdchSpVdmlFT4iBUCl8HYlzAymIvqD3NL6Jo+vI5QltU8jAWmsWBudImnEh+hlyz0uuIjmQKgUxlGqsWIepFPRM6xmKoVyl89LapTWL1UhUqdJTbaw1C2sWhlyTgyI6tuNEi75wL996qlmXx7dxfBPzR67GirZp1IhgCm4J2QwNZ9kubNQgB28K0VvJPS/5HNIOgwycaJ1pt8O5aIZMJw8JuSG0RWECm66daLMwUSM6eFPs0VvRr/bi2zhpUTGQkK2aWs9coUZExOQuCS6C+CaWY7USvbD2i2VjDLmJq4eF6K1AX6ixUinABCAD/cS1HEn/1A/OA9qmqxvTWvHCvZ+b5C4pRD+DSteWtXPNOiy4DJK7BLLVSAwvw9qxH98lcqxwhsaYzXY2xsS3RUc/h9mvwFCCu0dPQKUqvo3juyS8Ct1NQ8+0zjTvCf7IaZuyDtNTvWm5EP23cFLsr3tONExAjhR/5GIg3VFpM6+jRuSf1+PbmHc573F3MhUDEV6Flf1i69jK2osYCEhXriEDyPQ6r78Yx+j3d8Hrg/jDUfyxtlFH5P2Reln8ZrgVJwX/eCfHSqUK0rVocAsfTIB/OLK7u/aX70/726vgG5wUs19RY6XGSqWKP/IvPyECZMC6PLgIfkhxIfovWHuxL3dUX9AWrbzacx/XrpP7pBD9b/nODt/ZcX9Nsi883aKQAUzgR0OjEP2UPwGEVjUjFwPnDAAAAABJRU5ErkJggg==" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;fitCenter&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;3&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;按比例拉伸图片，拉伸后图片的高度为&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的高度，且显示在&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的中间&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAeCAIAAABoq03CAAAE+UlEQVRoge3ar2ujSRjA8VesqNg/oOLELaxI4MQVKrawpoEVt3BiCysusKK8rCihYnlZUV5qyktEGSLKS0V5qShMRGAqAhMRmJjARAQmIvBEvPBERDwiYkTEiIr3xJumv4709u72WPF+GROI+mR43skknvdjlH23VfSgAvp/KvM8WSqLX7fyVUB/r6BUDo/D2mHN3/f9fb+671f3fb69ZV94+XIF9H8SbwnVVThDPdS8xaMGC45C/6CWi1c/+exdhe1W2NsK262w3Yrd2Cig/0nylOmhMWMjrgXOkOYEKZiRkV3Fm5ydxeFJWPsS+Ac1/7Pvf/ar+9Xqp8fL/1h9+gEUPYhKZdGWNCeYAE6RNVhUj1iD8SsuuxJScAtnFxZnaMZG9bVsS97k8UXMGiw6iYKjsHZQq/5R1ZubBfS6qFTmLaGHBiYAE4Ap4hRhAnqoZUfKjhRtEV/Eoi2yeznnZFPQUYhHoapH1X2/gH4mKpVlV2VZ5m5clmXWWpiA6inVV2ZkiMjl3dyt/M36itvDwFkLn/zal1oB/UxUKsuOhAkkl4nsSkxxRWkXliwREc4IUjQTY4ZGD7QeaD0yvMnNlwAPAn0YBEdhAf1MVCrzFs+yjOakB5o3eXwe4xRlR5qxISJrrbXWuaV+dpM552hOkC4njGjL4CjY+7BXQK+LSuXkihORaAsiWs4H5/IZglMUbcHOGGsw1mC8xWVX6qHGKdLc5u/EGQZfg8q7SgG9LiqVk8uEiMzIiLbgLc6bXHalGRmcoV3YfCPf7mIwI6MHWnaluBa8xUVbIFFUj7aefKsselDmeeKUERFOMX/oZVkGKciOZA2WXCaqp8S1UH2FU3QL55zLbpb0eTS3YT0qF9DryzyPnzJIQfd1cpXkj0RIYXmMu1keomECeqBVT1lr7yvnOz08Cbfe7BTQ68o8L6lHMIGcFWeo+opf8eQygQnIroQx4BSXT8WFdU+iOUV1trVd7Oi1ZZ6XnIRmbNyNU12l+sqM4e6ROLcwBtVT/JLHZ3F0GuXzhLc4pOCcswtLc2KNuIB+pszzkuNI9bUZgx5qMzLiWpiRwSniDNVAq56C9I6eaHmwwxla5+zC2YVlp2ynGB3ryzwvOYlUT+EMcYo4RdGW8Xkcn8WyI83I8BaP6hFMgYgejY5c2S1cVGc7bwvotWWelxyH/FpACjk0pqiHWvVUPpohxeQqYWeMNzlM4L51Dm0XNqpHO2+Lc/Ta8PWr+DxOmlz1NaTLTY2zfBESEVFykQRfg/gs1iOzhF44d6tsrWVncWW3gF4b9JQZGTMGmACkgE+s9VD7n/3gMOAtvrxjWhEv8u/nNrlICuhnMuNb5cnSmrd48DWIz2NIIbcOj8Pqvh9fJHpocIZk7SPo+LzY0c9lt7dgoGGgc2gzNvF5HF8k4UmY32ngDDFF2VWyI3mLi2uBU7yvXED/rXIU9/Or1abWQyM7UvV1fql0f15H9cg/rMXnsWxL2ZX5lanqq/Ak3NouTh1rW7movoLx3QCBFFfz+lacot/eB2924o978R/Ve2uPfdgzL4vfDNeWo9Dv7/XImLGB8Qoa8gMfTEB+3HObm+6nx1f761fRg3IU+0vZjIwZGTM2oi11X6+4ZUcGR8E3ERfQf9HKxb3cMD3Fm3zr9av85co6uUwK6H/bIx25sZH/Ncm98LDJIQWYwLcOjR8K+k+aZjVXbitbIwAAAABJRU5ErkJggg==" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;fitEnd&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;4&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;按比例拉伸图片，拉伸后图片的高度为&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的高度，且显示在&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的右边&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAeCAIAAABoq03CAAAE9UlEQVRoge2asWsbSRSHt0jhIn+AiyvOkELqTuAihjQWpLjAFTGkiMCFWVIY4SIsLsySRiwqzKDCLC7M4sIwKgSjQjAuBKNGMCoEo2LhqVh4KlRMoWIKFVOo2CtGUZTkkC93l6v24zWCrT49fu/tkzyvYIv8p1XBVxSi/ydyzxMvDnip7KoQ/bOAUjn8FNYv6v6Z75/5tTO/dubTw4p55rmyhej/BNphoi9wjnIsaYdGLRJchf553RmvnfrkdZUcV8mrKjmukuOq2dsrRP8T+DWRY6VSxboM56gXGjJQE8X7grYpuYnDRlj/GPjndf+D73/wa2e12um35b+rff8FFHyFLpVZj+uFhingDEmLRM2ItAh9oLzPIQO7tGZpcI4qVWIoeY/TNo3vYtIiUSMKrsL6eb32vib39wvRu9ClMu0wOZIwBcgQ54gzhBTkSLIucxXfxazH8i2stbzN8DLAy0A0Se3ML0Q/gS6VeV/keW5XNs9zYwxMQQyEGAo1UVpr61h9KfewfKDmIrDGwKlf/1gvRD+BLpX5I4cpJPcJ73PMcKPSLI02WmuNcw0ZqqlSYyVHUo6knCjapupjgOeBvAiCq7AQ/QS6VKYdmue5Xmg5krRN49sYZ8gfuUqV1toYY4yxdm0/X+XWWr3QkCFMQY4l6/HgKjh5e1KI3oUulZMHqrVmPaa1XueDtS5DcIasx8gNIS1CWoR2KO9zOZY4Q70w7kmcY3AZVF9XC9G70KVycp9oreVYsg6jbUo7VAzFup2XxjWytVZr7VpYDATvcdqhtE1Zl6HWUTOqHFYK0bvIPY9dE601ztANvTzPIQP+yEmLJPeJGAjWZWIocIZ2aa21+Wqt3qEXJmxG5d8K0TvJPY9eE8hADmXykLiRCBms17jVeomGKciRFANhjNm27PI6bISVl0eF6F3knpc0I5iC04pzFENBH2hyn8AUeJ9DCjjD9VRcGvsdeqGjJimi4wlyz0saoUqVXVnRF2IoVApfRuLCQApiIOg9jW/i6DpyeUI7FDKw1pql0QtNWnEh+glyz0sakRxKlYIYSTVRrMtUCjhHnGsxkut0Xlm7sma5HokqVThDY61ZWrM05JocFdGxGydaDIR7+cYZsh6Pb+P4JuaPXE0U7dCoGcEM3BKyHRrOsl3aqEmOXhWid5J7XvIppF0GGTjRmKHb4Vw0Q4bJQ0JuCG1TmMK2ayfaLE3UjI5eFXv0TvDFQXwbJ20qhhKydVPj3JVGrbXWyV0SXAbxTSwnai16ae1ny8YYchNXjwvRO4GBUBOlUoApQAb4nWs5lv4HP7gIaIeub0wbxUv3fm6Su6QQ/QQq3VhG55p1WXAVJHcJZOuRGF6FtVM/vkvkROm5NsZst7MxJr4tOvopzGEFRhLcPXoKKlXxbRzfJWEjdDcNnCNmyPuCP3LaoazLcIbblgvRfwsnxf564ETDFORY8UcuhtIdlbbzOmpG/kU9vo15j/M+dydTMRRhI6wcFlvHTjZexFBAunYNGUCGm7z+bFxHv78JXh7F707i97WtOiFvT9Tz4jfDnTgp+o83cqJUqiDdiAa38MEU+LsTu79vf/n2tL+7Cr7CSTGHFTVRaqJUqvgj//wTIkAGrMeDy+CHFBei/4KNF/t8Tw0EbdPKiwP3ceM6uU8K0f+Wb+zwvT331yT7zMM2hQxgCj8aGq7+BHcyNSMhJPjUAAAAAElFTkSuQmCC" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;center&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;5&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;按原图大小显示图片，但图片宽高大于&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的宽高时，截图图片中间部分显示&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="data:image/png;base64,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" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;centerCrop&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;6&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;按比例放大原图直至等于某边&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的宽高显示。&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="data:image/png;base64,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" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="96" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 72.3pt; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;centerInside&lt;/p&gt;&lt;/td&gt;&lt;td width="38" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 1cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;7&lt;/p&gt;&lt;/td&gt;&lt;td width="170" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: windowtext; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 127.55pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;当原图宽高或等于&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的宽高时，按原图大小居中显示；反之将原图缩放至&lt;/span&gt;View&lt;span style="font-family: 宋体; "&gt;的宽高居中显示。&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="data:image/png;base64,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" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;（译者注：设置图片的填充方式。）&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:src&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;设置可绘制对象作为&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;显示的内容&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="189" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: black; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 5cm; "&gt;&lt;p align="center" style="line-height: 18px; text-align: center; "&gt;&lt;strong&gt;&lt;span style="color: #c00000; "&gt;android:tint&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="321" style="font-size: 12px; color: #454545; border-top-width: initial; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: black; border-bottom-color: black; border-left-color: initial; border-collapse: collapse; padding-top: 0cm; padding-right: 5.4pt; padding-bottom: 0cm; padding-left: 5.4pt; width: 240.95pt; "&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;为图片设置着色颜色。（译者注：将图片渲染成指定的颜色。见下图：&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;img src="data:image/png;base64,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" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-style: initial; border-color: initial; " /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 18px; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;左边为原图，右边为设置后的效果，见后面代码。）&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;公共方法&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public final void&amp;nbsp;&lt;strong&gt;clearColorFilter&lt;/strong&gt;&amp;nbsp;()&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;（译者注：清除颜色过滤，参见&lt;/span&gt;&lt;a href="http://blog.csdn.net/wanglong0537/archive/2011/04/02/6298713.aspx" style="color: #1a8bc8; text-decoration: none; "&gt;&lt;span style="font-family: 宋体; "&gt;这里&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 宋体; "&gt;）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public int&amp;nbsp;&lt;strong&gt;getBaseline&lt;/strong&gt;&amp;nbsp;()&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回部件顶端到文本基线的偏移量。如果小部件不支持基线对齐，该方法返回&lt;/span&gt;&amp;nbsp;-1&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回值&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;小部件顶端到文本基线的偏移量；或者是&lt;/span&gt;&amp;nbsp;-1&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;当小部件不支持基线对齐时。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public boolean&amp;nbsp;&lt;strong&gt;getBaselineAlignBottom&lt;/strong&gt;&amp;nbsp;()&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回当前视图基线是否将考虑视图的底部。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参见&lt;/span&gt;&lt;/p&gt;&lt;p&gt;setBaselineAlignBottom(boolean)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public Drawable&amp;nbsp;&lt;strong&gt;getDrawable&lt;/strong&gt;&amp;nbsp;()&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回视图的可绘制对象；如果没有关联可绘制对象，返回空。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public Matrix&amp;nbsp;&lt;strong&gt;getImageMatrix&lt;/strong&gt;&amp;nbsp;()&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回视图的选项矩阵。当绘制时，应用于视图的可绘制对象。如果没有矩阵，&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;函数返回空。不要更改这个矩阵。如果你要为可绘制对象设置不同的矩阵，&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;请调用&lt;/span&gt;&amp;nbsp;setImageMatrix()&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public ImageView.ScaleType&amp;nbsp;&lt;strong&gt;getScaleType&lt;/strong&gt;&amp;nbsp;()&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回当前&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;使用的缩放类型。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;android:scaleType&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参见&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ImageView.ScaleType&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;invalidateDrawable&lt;/strong&gt;&amp;nbsp;(Drawable dr)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;使指定的可绘制对象失效。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;dr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;要设为失效的可绘制对象。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;jumpDrawablesToCurrentState&lt;/strong&gt;&amp;nbsp;()&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;调用与视图相关的所有可绘制对象的&lt;/span&gt;Drawable.jumpToCurrentState()&lt;span style="font-family: 宋体; "&gt;方法。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public int[]&amp;nbsp;&lt;strong&gt;onCreateDrawableState&lt;/strong&gt;&amp;nbsp;(int extraSpace)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;为当前视图生成新的&lt;/span&gt;&amp;nbsp;Drawable&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;状态时发生。当视图系统检测到缓存的可绘制对象失效时，调用该方法&lt;/span&gt;.&lt;span style="font-family: 宋体; "&gt;你可以使用&lt;/span&gt;&amp;nbsp;getDrawableState()&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;方法重新取得当前的状态。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;extraSpace&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;如果为非零，该值为你要在返回值的数组中存放的你自己的状态信息的数量。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回值&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回保存了视图的当前&lt;/span&gt;&amp;nbsp;Drawable&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;状态的数组。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setAdjustViewBounds&lt;/strong&gt;&amp;nbsp;(boolean adjustViewBounds)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;当你需要在&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;调整边框时保持可绘制对象的比例时，将该值设为真。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;adjustViewBounds&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;是否调整边框，以保持可绘制对象的原始比例。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:adjustViewBounds&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setAlpha&lt;/strong&gt;&amp;nbsp;(int alpha)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;（译者注：设置透明度）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setBaseline&lt;/strong&gt;&amp;nbsp;(int baseline)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;设置部件顶部边界文本基线的偏移量。这个值覆盖&lt;/span&gt;setBaselineAlignBottom(boolean)&lt;span style="font-family: 宋体; "&gt;设置的属性值。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;baseline&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;使用的基线，或不提供设置为&lt;/span&gt;-1&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:baseline&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参见&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setBaseline(int)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setBaselineAlignBottom&lt;/strong&gt;&amp;nbsp;(boolean aligned)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;设置是否设置视图底部的视图基线。设置这个值覆盖&lt;/span&gt;setBaseline()&lt;span style="font-family: 宋体; "&gt;的所有调用。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;aligned&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;如果为&lt;/span&gt;true&lt;span style="font-family: 宋体; "&gt;，图像视图将基线与父控件底部边缘对齐。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:baselineAlignBottom&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public final void&amp;nbsp;&lt;strong&gt;setColorFilter&lt;/strong&gt;&amp;nbsp;(int color)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;为图片设置着色选项。采用&lt;/span&gt;SRC_ATOP&lt;span style="font-family: 宋体; "&gt;合成模式。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;color&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;应用的着色颜色。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:tint&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setColorFilter&lt;/strong&gt;&amp;nbsp;(ColorFilter cf)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;为图片应用任意颜色滤镜。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;cf&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;要应用的颜色滤镜（可能为空）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public final void&amp;nbsp;&lt;strong&gt;setColorFilter&lt;/strong&gt;&amp;nbsp;(int color, PorterDuff.Mode mode)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;为图片设置着色选项。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;color&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;应用的着色颜色。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;mode&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;如何着色。标准模式为&lt;/span&gt;&amp;nbsp;SRC_ATOP&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:tint&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setImageBitmap&lt;/strong&gt;&amp;nbsp;(Bitmap bm)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;设置位图作为该&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;的内容。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;bm&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;设置的位图。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setImageDrawable&lt;/strong&gt;&amp;nbsp;(Drawable drawable)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;设置可绘制对象为该&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;显示的内容。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;drawable&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;设置的可绘制对象。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setImageLevel&lt;/strong&gt;&amp;nbsp;(int level)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;设置图片的等级，当图片来自于&lt;/span&gt;&amp;nbsp;LevelListDrawable&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;时。（译者注：使用参见&lt;/span&gt;&lt;a href="http://www.20864.com/wp/165.html" style="color: #1a8bc8; text-decoration: none; "&gt;&lt;span style="font-family: 宋体; "&gt;这里&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 宋体; "&gt;）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;level&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;图片的新的等级。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setImageMatrix&lt;/strong&gt;&amp;nbsp;(Matrix matrix)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;（译者注：矩阵变换）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setImageResource&lt;/strong&gt;&amp;nbsp;(int resId)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;通过资源&lt;/span&gt;ID&lt;span style="font-family: 宋体; "&gt;设置可绘制对象为该&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;显示的内容。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: lime; "&gt;注意：&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;该操作读取位图，并在&lt;/span&gt;&amp;nbsp;UI&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;线程中解码，因此可能导致反应迟缓。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;如果反应迟缓，可以考虑用&lt;/span&gt;&amp;nbsp;setImageDrawable(Drawable)&lt;span style="font-family: 宋体; "&gt;、&lt;/span&gt;&amp;nbsp;setImageBitmap(Bitmap)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;或者&lt;/span&gt;&amp;nbsp;BitmapFactory&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;代替。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;resId&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;可绘制对象的资源标识。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:src&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setImageState&lt;/strong&gt;&amp;nbsp;(int[] state, boolean merge)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;（译者注：设置视图的可见和不可见，使用参见&lt;/span&gt;&lt;a href="http://www.20864.com/wp/165.html" style="color: #1a8bc8; text-decoration: none; "&gt;&lt;span style="font-family: 宋体; "&gt;这里&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 宋体; "&gt;）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setImageURI&lt;/strong&gt;&amp;nbsp;(Uri uri)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;设置指定的&lt;/span&gt;&amp;nbsp;URI&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;为该&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;显示的内容。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: lime; "&gt;注意：&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;该操作读取位图，并在&lt;/span&gt;&amp;nbsp;UI&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;线程中解码，因此可能导致反应迟缓。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;如果反应迟缓，可以考虑用&lt;/span&gt;&amp;nbsp;setImageDrawable(Drawable)&lt;span style="font-family: 宋体; "&gt;、&lt;/span&gt;&amp;nbsp;setImageBitmap(Bitmap)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;或者&lt;/span&gt;&amp;nbsp;BitmapFactory&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;代替。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;uri &amp;nbsp;&lt;span style="font-family: 宋体; "&gt;图像的&lt;/span&gt;&amp;nbsp;URI&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setMaxHeight&lt;/strong&gt;&amp;nbsp;(int maxHeight)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;用于设置该视图支持的最大高度的可选参数。只有&lt;/span&gt;&amp;nbsp;setAdjustViewBounds(boolean)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;为真时有效。要设置图像最大尺寸为&lt;/span&gt;&amp;nbsp;100&lt;span style="font-family: 宋体; "&gt;&amp;#215;&lt;/span&gt;100&lt;span style="font-family: 宋体; "&gt;，并保持原始比率，做法如下：&lt;/span&gt;&lt;/p&gt;&lt;p&gt;1)&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;设置&lt;/span&gt;&amp;nbsp;adjustViewBounds&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;为真；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;2)&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;设置&lt;/span&gt;&amp;nbsp;maxWidth&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;和&lt;/span&gt;&amp;nbsp;maxHeight&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;为&lt;/span&gt;&amp;nbsp;100&lt;span style="font-family: 宋体; "&gt;；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;3)&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;设置宽、高的布局参数为&lt;/span&gt;&amp;nbsp;WRAP_CONTENT&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;注意，如果原始图像较小，即使设置了该参数，图像仍然要比&lt;/span&gt;&amp;nbsp;100&lt;span style="font-family: 宋体; "&gt;&amp;#215;&lt;/span&gt;100&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;小。如果要设置图片为&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;固定大小，需要在布局参数中指定大小，并使用&lt;/span&gt;&amp;nbsp;setScaleType(ImageView.ScaleType)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;函数来检测，如何&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;将其调整到适当的大小。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;maxHeight&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;该视图的最大高度。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:maxHeight&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setMaxWidth&lt;/strong&gt;&amp;nbsp;(int maxWidth)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;用于设置该视图支持的最大宽度的可选参数。只有&lt;/span&gt;&amp;nbsp;setAdjustViewBounds(boolean)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;为真时有效。要设置图像最大尺寸为&lt;/span&gt;&amp;nbsp;100&lt;span style="font-family: 宋体; "&gt;&amp;#215;&lt;/span&gt;100&lt;span style="font-family: 宋体; "&gt;，并保持原始比率，做法如下：&lt;/span&gt;&lt;/p&gt;&lt;p&gt;4)&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;设置&lt;/span&gt;&amp;nbsp;adjustViewBounds&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;为真；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;5)&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;设置&lt;/span&gt;&amp;nbsp;maxWidth&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;和&lt;/span&gt;&amp;nbsp;maxHeight&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;为&lt;/span&gt;&amp;nbsp;100&lt;span style="font-family: 宋体; "&gt;；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;6)&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;设置宽、高的布局参数为&lt;/span&gt;&amp;nbsp;WRAP_CONTENT&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;注意，如果原始图像较小，即使设置了该参数，图像仍然要比&lt;/span&gt;&amp;nbsp;100&lt;span style="font-family: 宋体; "&gt;&amp;#215;&lt;/span&gt;100&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;小。如果要设置图片为&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;固定大小，需要在布局参数中指定大小，并使用&lt;/span&gt;&amp;nbsp;setScaleType(ImageView.ScaleType)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;函数来检测，如何&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;将其调整到适当的大小。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;maxWidth&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;该视图的最大宽度。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:maxWidth&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setScaleType&lt;/strong&gt;&amp;nbsp;(ImageView.ScaleType scaleType)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;控制图像应该如何缩放和移动，以使图像与&lt;/span&gt;&amp;nbsp;ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;一致。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;scaleType&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;需要的缩放方式。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;相关&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;属性&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:scaleType&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public void&amp;nbsp;&lt;strong&gt;setSelected&lt;/strong&gt;&amp;nbsp;(boolean selected)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;改变视图的选中状态。视图有选中和未选中两个状态。注意，选择状态不同于焦点。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;典型的选中的视图是象&lt;/span&gt;&amp;nbsp;ListView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;和&lt;/span&gt;&amp;nbsp;GridView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;这样的&lt;/span&gt;&amp;nbsp;AdapterView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中显示的&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;内容；选中的内容会显示为高亮。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;selected&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;为真，将视图设为选中状态；否则为假。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;受保护方法&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;protected void&amp;nbsp;&lt;strong&gt;drawableStateChanged&lt;/strong&gt;&amp;nbsp;()&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;在视图状态的变化影响到所显示可绘制对象的状态时调用该方法。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;覆盖该方法时，要确保调用了父类的该方法。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;protected void&amp;nbsp;&lt;strong&gt;onDraw&lt;/strong&gt;&amp;nbsp;(Canvas canvas)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;实现该方法，用于自己绘制内容。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;canvas&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;用于绘制背景的画布。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;protected void&amp;nbsp;&lt;strong&gt;onMeasure&lt;/strong&gt;&amp;nbsp;(int widthMeasureSpec, int heightMeasureSpec)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;评估视图及其内容，以决定其宽度和高度&lt;/span&gt;.&lt;span style="font-family: 宋体; "&gt;此方法由&lt;/span&gt;&amp;nbsp;measure(int, int)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;调用，子类可以重载以提供更精确、更有效率的衡量其内容尺寸的方法。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;约定：&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;覆盖该方法时，必须调用&lt;/span&gt;&amp;nbsp;setMeasuredDimension(int, int)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;方法来保存评估结果的视图的宽度和高度&lt;/span&gt;.&lt;span style="font-family: 宋体; "&gt;如果忘记将导致&lt;/span&gt;&amp;nbsp;measure(int, int)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;方法抛出&lt;/span&gt;IllegalStateException&lt;span style="font-family: 宋体; "&gt;异常。要有效的利用父类的&lt;/span&gt;&amp;nbsp;onMeasure(int, int)&lt;span style="font-family: 宋体; "&gt;方法。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;基类测量的是背景的大小，除非&lt;/span&gt;&amp;nbsp;MeasureSpec&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;允许超过背景&lt;/span&gt;.&lt;span style="font-family: 宋体; "&gt;子类应该重写&lt;/span&gt;&amp;nbsp;onMeasure(int, int)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;方法，以为其内容提供更适合的大小。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;如果重写了该方法，子类要确保其高度和宽度大于等于视图的最小高度和宽度&lt;/span&gt;.&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;（&lt;/span&gt;getSuggestedMinimumHeight()&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;和&lt;/span&gt;&amp;nbsp;getSuggestedMinimumWidth()&lt;span style="font-family: 宋体; "&gt;）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;widthMeasureSpec&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;父视图要求的横向空间大小&lt;/span&gt;.&lt;span style="font-family: 宋体; "&gt;该要求由&lt;/span&gt;&amp;nbsp;View.MeasureSpec&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;进行了编码处理。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;heightMeasureSpec&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;父视图要求的纵向空间大小&lt;/span&gt;.&lt;span style="font-family: 宋体; "&gt;该要求由&lt;/span&gt;&amp;nbsp;View.MeasureSpec&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;进行了编码处理。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;protected boolean&amp;nbsp;&lt;strong&gt;onSetAlpha&lt;/strong&gt;&amp;nbsp;(int alpha)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;透明度改变时执行。子类可以使用该方法指定透明度值，然后返回真；&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;在调用&lt;/span&gt;&amp;nbsp;onDraw()&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;时，使用该透明度值。如果返回假，则先在不可见的缓存中绘制视图，&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;完成该请求；看起来不错，但是可能相对于在子类中绘制要慢。默认实现返回假。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;alpha&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;应用到视图的透明度值&lt;/span&gt;&amp;nbsp;(0&lt;span style="font-family: 宋体; "&gt;&amp;#8230;&lt;/span&gt;255)&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回值&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;如果该类可以绘制该阿尔法值返回真。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;protected boolean&amp;nbsp;&lt;strong&gt;setFrame&lt;/strong&gt;&amp;nbsp;(int l, int t, int r, int b)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;为视图指定大小和位置。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;该方法有布局调用。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;l&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;左侧位置，相对于父容器。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;顶部位置，相对于父容器。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;r&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;右侧位置，相对于父容器。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;底部位置，相对于父容器。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回值&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; true&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;如果新的大小和位置与之前的不同，返回真。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;protected boolean&amp;nbsp;&lt;strong&gt;verifyDrawable&lt;/strong&gt;&amp;nbsp;(Drawable dr)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;如果你的视图子类显示自己的可绘制对象，他应该重写此方法并为自己的每个可绘制对象返回真。该函数允许为这些可绘制对象准备动画效果。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;重写此方法时，要保证调用其父类的该方法。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;参数&lt;/span&gt;&lt;/p&gt;&lt;p&gt;dr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;待校验的可绘制对象&lt;/span&gt;.&lt;span style="font-family: 宋体; "&gt;如果是你显示的对象之一，返回真；否则返回调用父类的返回值。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 宋体; "&gt;返回值&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; boolean&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;如果可绘制对象已经显示在视图上了，返回真；否则返回假，不允许动画效果。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;补充&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;文章精选&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://www.cnblogs.com/shadowjl/archive/2011/04/01/2002799.html" style="color: #1a8bc8; text-decoration: none; "&gt;Android ImageView&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;加边框&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://blog.3gstdy.com/archives/38" style="color: #1a8bc8; text-decoration: none; "&gt;Android&lt;span style="font-family: 宋体; "&gt;用&lt;/span&gt;ImageView&lt;span style="font-family: 宋体; "&gt;显示本地和网上的图片&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://wang-peng1.iteye.com/blog/830311" style="color: #1a8bc8; text-decoration: none; "&gt;imageView&lt;span style="font-family: 宋体; "&gt;动画效果&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;示例代码&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:tint&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: teal; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:background&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@android:color/white"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:src&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@drawable/btn_mode_switch_bg"&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_width&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_height&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&lt;span style="color: teal; "&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="color: teal; "&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: teal; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_marginLeft&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"5dp"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:background&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@android:color/white"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:tint&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"#ffff00"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:src&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@drawable/btn_mode_switch_bg"&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_width&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_height&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&lt;span style="color: teal; "&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="color: teal; "&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;android:cropToPadding&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: teal; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:background&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@android:color/white"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:scrollY&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"-10px"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:cropToPadding&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"true"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:src&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@drawable/btn_mode_switch_bg"&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_width&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_height&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&lt;span style="color: teal; "&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="color: teal; "&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: teal; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:background&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@android:color/white"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:scrollY&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"10px"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:cropToPadding&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"true"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:src&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@drawable/btn_mode_switch_bg"&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_width&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_height&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&lt;span style="color: teal; "&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="color: teal; "&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: teal; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:paddingTop&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"10px"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:background&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@android:color/white"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:scrollY&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"10px"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:cropToPadding&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"true"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:src&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@drawable/btn_mode_switch_bg"&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_width&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_height&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&lt;span style="color: teal; "&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="color: teal; "&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: teal; "&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:paddingTop&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"10px"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:background&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@android:color/white"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:scrollY&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"10px"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:cropToPadding&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"false"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:src&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"@drawable/btn_mode_switch_bg"&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_width&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&lt;span style="color: #7f007f; "&gt;android:layout_height&lt;/span&gt;&lt;span style="color: black; "&gt;=&lt;/span&gt;&lt;em&gt;&lt;span style="color: #2a00ff; "&gt;"wrap_content"&lt;/span&gt;&lt;/em&gt;&lt;span style="color: teal; "&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #3f7f7f; "&gt;ImageView&lt;/span&gt;&lt;span style="color: teal; "&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="line-height: 19px; font-size: 10pt; background-color: #ffffff; font-family: 'Courier New'; color: teal; "&gt;&lt;br clear="all" style="page-break-before: always; " /&gt;&lt;/span&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="center" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: center; "&gt;&lt;strong&gt;&lt;span style="line-height: 43px; font-size: 22pt; "&gt;ImageView.ScaleType&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: center; "&gt;&lt;span style="font-family: 宋体; "&gt;译者署名：小易&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: center; "&gt;&lt;span style="font-family: 宋体; "&gt;译者博客：&lt;/span&gt;&lt;a href="http://blog.sina.com.cn/xjtuyi" style="color: #1a8bc8; text-decoration: none; "&gt;http://blog.sina.com.cn/xjtuyi&lt;/a&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: center; "&gt;&lt;span style="font-family: 宋体; "&gt;版本：&lt;/span&gt;Android 3.1 r1&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;结构&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;继承关系&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 21pt; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;em&gt;public static final enum&amp;nbsp;&lt;span style="color: #c00000; "&gt;ImageView.ScaleType extends&amp;nbsp;Enum&amp;lt;E&amp;nbsp;extends&amp;nbsp;Enum&amp;lt;E&amp;gt;&amp;gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 42pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;java.lang.Object&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 42pt; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;java.lang.Enum&amp;lt;E extends java.lang.Enum&amp;lt;E&amp;gt;&amp;gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; margin-left: 63pt; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;android.widget.ImageView.ScaleType&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;类概述&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;将图片边界缩放，以适应视图边界时的可选项。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;常量&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public static final ImageView.ScaleType&amp;nbsp;&lt;strong&gt;CENTER&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;在视图中使图像居中，不执行缩放。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;在&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中可以使用的语法：&lt;/span&gt;&amp;nbsp;&lt;span style="color: #007900; "&gt;android:scaleType="center"&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public static final ImageView.ScaleType&amp;nbsp;&lt;strong&gt;CENTER_CROP&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;均衡的缩放图像（保持图像原始比例），使图片的两个坐标（宽、高）都大于等于&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;相应的视图坐标（负的内边距）。图像则位于视图的中央。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;在&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中可以使用的语法：&lt;/span&gt;&lt;span style="color: #007900; "&gt;android:scaleType="centerCrop"&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public static final ImageView.ScaleType&amp;nbsp;&lt;strong&gt;CENTER_INSIDE&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;均衡的缩放图像（保持图像原始比例），使图片的两个坐标（宽、高）都小于等于&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;相应的视图坐标（负的内边距）。图像则位于视图的中央。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;在&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中可以使用的语法：&lt;/span&gt;&lt;span style="color: #007900; "&gt;android:scaleType="centerInside"&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public static final ImageView.ScaleType&amp;nbsp;&lt;strong&gt;FIT_CENTER&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;使用&lt;/span&gt;&amp;nbsp;CENTER&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;方式缩放图像。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;在&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中可以使用的语法：&lt;/span&gt;&amp;nbsp;&lt;span style="color: #007900; "&gt;android:scaleType="fitCenter"&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public static final ImageView.ScaleType&amp;nbsp;&lt;strong&gt;FIT_END&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;使用&lt;/span&gt;&amp;nbsp;END&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;方式缩放图像。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;在&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中可以使用的语法：&lt;/span&gt;&amp;nbsp;&lt;span style="color: #007900; "&gt;android:scaleType="fitEnd"&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public static final ImageView.ScaleType&amp;nbsp;&lt;strong&gt;FIT_START&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;使用&lt;/span&gt;&amp;nbsp;START&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;方式缩放图像。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;在&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中可以使用的语法：&lt;/span&gt;&lt;span style="color: #007900; "&gt;android:scaleType="fitStart"&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public static final ImageView.ScaleType&amp;nbsp;&lt;strong&gt;FIT_XY&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;使用&lt;/span&gt;&amp;nbsp;FILL&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;方式缩放图像。&lt;/span&gt;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;在&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中可以使用的语法：&lt;/span&gt;&amp;nbsp;&lt;span style="color: #007900; "&gt;android:scaleType="fitXY"&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&amp;nbsp;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #d9d9d9; "&gt;public static final ImageView.ScaleType&amp;nbsp;&lt;strong&gt;MATRIX&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="line-height: 19px; text-indent: 21pt; color: #4b4b4b; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; background-color: #ffffff; text-align: left; "&gt;&lt;span style="font-family: 宋体; "&gt;绘制时，使用图像矩阵方式缩放。图像矩阵可以通过&lt;/span&gt;&amp;nbsp;setImageMatrix(Matrix)&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;设置。在&lt;/span&gt;&amp;nbsp;XML&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;中可以使用的语法：&lt;/span&gt;&amp;nbsp;&lt;span style="color: #007900; "&gt;android:scaleType="matrix"&lt;/span&gt;&lt;span style="font-family: 宋体; "&gt;。&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="line-height: 24px; font-size: 12pt; font-family: 宋体; "&gt;补充&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: 宋体; "&gt;文章精选&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="http://blog.sina.com.cn/s/blog_407abb0d0100mao1.html" style="color: #1a8bc8; text-decoration: none; "&gt;Android API&lt;span style="font-family: 宋体; "&gt;之&lt;/span&gt;ImageView.ScaleType&lt;span style="font-family: 宋体; "&gt;代码演示&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2311878.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2012/01/04/2311878.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2012/01/02/2310326.html</id><title type="text">android PorterDuffXfermode ，PorterDuff.Mode 使用 以及Porter-Duff规则详解</title><summary type="text">1.下面的Xfermode子类可以改变这种行为：AvoidXfermode 指定了一个颜色和容差，强制Paint避免在它上面绘图(或者只在它上面绘图)。PixelXorXfermode 当覆盖已有的颜色时，应用一个简单的像素XOR操作。PorterDuffXfermode 这是一个非常强大的转换模式，使用它，可以使用图像合成的16条Porter-Duff规则的任意一条来控制Paint如何与已有的Canvas图像进行交互。要应用转换模式，可以使用setXferMode方法，如下所示：AvoidXfermode avoid = new AvoidXfermode(Color.BLUE, 10, A</summary><published>2012-01-02T11:38:00Z</published><updated>2012-01-02T11:38:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2012/01/02/2310326.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2012/01/02/2310326.html"/><content type="html">&lt;div&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; font-size: 24px; "&gt;1.下面的Xfermode子类可以改变这种行为：&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;AvoidXfermode&amp;nbsp; 指定了一个颜色和容差，强制Paint避免在它上面绘图(或者只在它上面绘图)。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;PixelXorXfermode&amp;nbsp; 当覆盖已有的颜色时，应用一个简单的像素XOR操作。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;PorterDuffXfermode&amp;nbsp; 这是一个非常强大的转换模式，使用它，可以使用图像合成的16条Porter-Duff规则的任意一条来控制Paint如何与已有的Canvas图像进行交互。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;要应用转换模式，可以使用setXferMode方法，如下所示：&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;AvoidXfermode avoid = new AvoidXfermode(Color.BLUE, 10, AvoidXfermode.Mode. AVOID);&amp;nbsp;&amp;nbsp;&amp;nbsp; borderPen.setXfermode(avoid);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&lt;span style="font-size: 24px; "&gt;2.Porter-Duff 效果图：&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; font-size: 24px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&lt;img src="http://hi.csdn.net/attachment/201111/22/0_13219433774KaR.gif" alt="" style="border-width: initial; border-color: initial; " /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; font-size: 24px; "&gt;3.16条Porter-Duff规则&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;1.PorterDuff.Mode.CLEAR&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp; 所绘制不会提交到画布上。&lt;br /&gt;2.PorterDuff.Mode.SRC&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp; 显示上层绘制图片&lt;br /&gt;3.PorterDuff.Mode.DST&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp;显示下层绘制图片&lt;br /&gt;4.PorterDuff.Mode.SRC_OVER&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp;正常绘制显示，上下层绘制叠盖。&lt;br /&gt;5.PorterDuff.Mode.DST_OVER&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp;上下层都显示。下层居上显示。&lt;br /&gt;6.PorterDuff.Mode.SRC_IN&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp; 取两层绘制交集。显示上层。&lt;br /&gt;7.PorterDuff.Mode.DST_IN&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp;取两层绘制交集。显示下层。&lt;br /&gt;8.PorterDuff.Mode.SRC_OUT&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;取上层绘制非交集部分。&lt;br /&gt;9.PorterDuff.Mode.DST_OUT&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;取下层绘制非交集部分。&lt;br /&gt;10.PorterDuff.Mode.SRC_ATOP&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;取下层非交集部分与上层交集部分&lt;br /&gt;11.PorterDuff.Mode.DST_ATOP&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp;取上层非交集部分与下层交集部分&lt;br /&gt;12.PorterDuff.Mode.XOR&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;13.PorterDuff.Mode.DARKEN&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&lt;br /&gt;14.PorterDuff.Mode.LIGHTEN&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&lt;br /&gt;15.PorterDuff.Mode.MULTIPLY&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: 'Microsoft YaHei'; "&gt;&lt;br /&gt;16.PorterDuff.Mode.SCREEN&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2310326.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2012/01/02/2310326.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2011/12/04/2275398.html</id><title type="text">UIApplicationDelegate协议定义的方法说明</title><summary type="text">现在来看协议中定义的这些需要实现的方法分别是什么作用：1、- (void)applicationWillResignActive:(UIApplication *)application说明：当应用程序将要入非活动状态执行，在此期间，应用程序不接收消息或事件，比如来电话了2、- (void)applicationDidBecomeActive:(UIApplication *)application说明：当应用程序入活动状态执行，这个刚好跟上面那个方法相反3、- (void)applicationDidEnterBackground:(UIApplication *)application说明</summary><published>2011-12-04T06:30:00Z</published><updated>2011-12-04T06:30:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2011/12/04/2275398.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2011/12/04/2275398.html"/><content type="html">&lt;div&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; background-color: #ffffff; "&gt;现在来看协议中定义的这些需要实现的方法分别是什么作用：&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;1、- (void)applicationWillResignActive:(UIApplication *)application&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当应用程序将要入非活动状态执行，在此期间，应用程序不接收消息或事件，比如来电话了&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;2、- (void)applicationDidBecomeActive:(UIApplication *)application&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当应用程序入活动状态执行，这个刚好跟上面那个方法相反&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;3、- (void)applicationDidEnterBackground:(UIApplication *)application&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当程序被推送到后台的时候调用。所以要设置后台继续运行，则在这个函数里面设置即可&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;4、- (void)applicationWillEnterForeground:(UIApplication *)application&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当程序从后台将要重新回到前台时候调用，这个刚好跟上面的那个方法相反。&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;5、- (void)applicationWillTerminate:(UIApplication *)application&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当程序将要退出是被调用，通常是用来保存数据和一些退出前的清理工作。这个需要要设置UIApplicationExitsOnSuspend的键值。&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;6、- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：iPhone设备只有有限的内存，如果为应用程序分配了太多内存操作系统会终止应用程序的运行，在终止前会执行这个方法，通常可以在这里进行内存清理工作防止程序被终止&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;7、- (void)applicationSignificantTimeChange:(UIApplication*)application&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当系统时间发生改变时执行&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;8、- (void)applicationDidFinishLaunching:(UIApplication*)application&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当程序载入后执行&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;9、- (void)application:(UIApplication)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当StatusBar框将要变化时执行&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;10、- (void)application:(UIApplication*)application willChangeStatusBarOrientation:&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;(UIInterfaceOrientation)newStatusBarOrientation&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;duration:(NSTimeInterval)duration&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当StatusBar框方向将要变化时执行&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;11、- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当通过url执行&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;12、- (void)application:(UIApplication*)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当StatusBar框方向变化完成后执行&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;&lt;span style="color: #ff0000; "&gt;13、- (void)application:(UIApplication*)application didChangeSetStatusBarFrame:(CGRect)oldStatusBarFrame&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; "&gt;说明：当StatusBar框变化完成后执行&lt;/p&gt;&lt;p&gt;下图是我总结的一个大概流程图，不是很准确但是基本上也说明了整个过程，仅供参考。&lt;/p&gt;&lt;p&gt;&lt;img src="http://pic002.cnblogs.com/images/2011/38096/2011032009525313.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2275398.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2011/12/04/2275398.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2011/12/02/2272239.html</id><title type="text">iPhone绘图关于QuartZ中绘制Line和虚线等</title><summary type="text">iPhone绘图关于QuartZ中绘制Line案例是本文要介绍的内容，主要介绍了如何在QuartZ中绘制Line的内容，来看详细内容。下面的代码和例子都是从官方的QuartzDemo中截取的，在此在写下以便以后用到。 1.基本的划线代码。CGContextRefcontext=UIGraphicsGetCurrentContext(); //Drawinglineswithawhitestrokecolor CGContextSetRGBStrokeColor(context,1.0,1.0,1.0,1.0); //Drawthemwitha2.0strokewidthsotheyareab.</summary><published>2011-12-02T07:56:00Z</published><updated>2011-12-02T07:56:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2011/12/02/2272239.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2011/12/02/2272239.html"/><content type="html">&lt;div&gt;&lt;p&gt;&lt;strong&gt;i&lt;a href="http://www.zhujiangroad.com/tag/2989.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;Phone&lt;/a&gt;绘图&lt;/strong&gt;关于&lt;strong&gt;QuartZ&lt;/strong&gt;中&lt;strong&gt;绘制&lt;/strong&gt;L&lt;a href="http://www.zhujiangroad.com/tag/8428.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;in&lt;/a&gt;e案例是本文要介绍的内容，主要介绍了如何在&lt;strong&gt;QuartZ&lt;/strong&gt;中&lt;strong&gt;绘制&lt;/strong&gt;Line的内容，来看详细内容&amp;nbsp;&amp;nbsp;。下面的&lt;a href="http://www.zhujiangroad.com/tag/4958.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;代码&lt;/a&gt;和例子都是从官方的&lt;strong&gt;Quartz&lt;/strong&gt;D&lt;a href="http://www.zhujiangroad.com/tag/6911.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;em&lt;/a&gt;o中截取的，在此在写下以便以后用到&amp;nbsp;&amp;nbsp;。&lt;/p&gt;&lt;p&gt;1.基本的划线代码&amp;nbsp;&amp;nbsp;。&lt;/p&gt;&lt;ol&gt;&lt;li&gt;CG&lt;a href="http://www.zhujiangroad.com/tag/5300.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;Context&lt;/a&gt;Ref&amp;nbsp;context&amp;nbsp;=&amp;nbsp;UIGraphicsGetCurrentContext(); &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Drawing&amp;nbsp;lines&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/6574.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;with&lt;/a&gt;&amp;nbsp;a&amp;nbsp;white&amp;nbsp;stroke&amp;nbsp;color &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextSetRGBStrokeColor(context,&amp;nbsp;1.0,&amp;nbsp;1.0,&amp;nbsp;1.0,&amp;nbsp;1.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Draw&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/8745.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;the&lt;/a&gt;m&amp;nbsp;with&amp;nbsp;a&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/5358.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;2.0&lt;/a&gt;&amp;nbsp;stroke&amp;nbsp;w&lt;a href="http://www.zhujiangroad.com/tag/6816.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;id&lt;/a&gt;th&amp;nbsp;so&amp;nbsp;they&amp;nbsp;are&amp;nbsp;a&amp;nbsp;bit&amp;nbsp;more&amp;nbsp;visible. &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextSetLineWi&lt;a href="http://www.zhujiangroad.com/tag/6856.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;dt&lt;/a&gt;h(context,&amp;nbsp;2.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Draw&amp;nbsp;a&amp;nbsp;single&amp;nbsp;line&amp;nbsp;from&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/7514.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;left&lt;/a&gt;&amp;nbsp;to&amp;nbsp;right &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextMoveToPoint(context,&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/5845.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;10&lt;/a&gt;.0,&amp;nbsp;30.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContext&lt;a href="http://www.zhujiangroad.com/tag/4665.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;Ad&lt;/a&gt;dLineToPoint(context,&amp;nbsp;310.0,&amp;nbsp;30.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextStrokePath(context); &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Draw&amp;nbsp;a&amp;nbsp;connected&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/8115.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;sequence&lt;/a&gt;&amp;nbsp;of&amp;nbsp;line&amp;nbsp;segments &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPoint&amp;nbsp;addLines[]&amp;nbsp;= &amp;nbsp;&lt;/li&gt;&lt;li&gt;{ &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(10.0,&amp;nbsp;90.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(&lt;a href="http://www.zhujiangroad.com/tag/3122.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;70&lt;/a&gt;.0,&amp;nbsp;60.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(130.0,&amp;nbsp;90.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(190.0,&amp;nbsp;60.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(&lt;a href="http://www.zhujiangroad.com/tag/2485.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;250&lt;/a&gt;.0,&amp;nbsp;90.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(310.0,&amp;nbsp;60.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;}; &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;B&lt;a href="http://www.zhujiangroad.com/tag/6854.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;ul&lt;/a&gt;k&amp;nbsp;call&amp;nbsp;to&amp;nbsp;add&amp;nbsp;lines&amp;nbsp;to&amp;nbsp;the&amp;nbsp;current&amp;nbsp;path. &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Equivalent&amp;nbsp;to&amp;nbsp;MoveToPoint(points[0]);&amp;nbsp;for(i=1;&amp;nbsp;i&amp;lt;count;&amp;nbsp;++i)&amp;nbsp;AddLineToPoint(points[i]); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextAddLines(context,&amp;nbsp;addLines,&amp;nbsp;sizeof(addLines)/sizeof(addLines[0])); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextStrokePath(context); &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Draw&amp;nbsp;a&amp;nbsp;series&amp;nbsp;of&amp;nbsp;line&amp;nbsp;segments.&amp;nbsp;Each&amp;nbsp;p&lt;a href="http://www.zhujiangroad.com/tag/6550.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;air&lt;/a&gt;&amp;nbsp;of&amp;nbsp;points&amp;nbsp;is&amp;nbsp;a&amp;nbsp;segment &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPoint&amp;nbsp;strokeSegments[]&amp;nbsp;= &amp;nbsp;&lt;/li&gt;&lt;li&gt;{ &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(10.0,&amp;nbsp;150.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(70.0,&amp;nbsp;120.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(130.0,&amp;nbsp;150.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(190.0,&amp;nbsp;120.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(250.0,&amp;nbsp;150.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGPointMake(310.0,&amp;nbsp;120.0), &amp;nbsp;&lt;/li&gt;&lt;li&gt;}; &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Bulk&amp;nbsp;call&amp;nbsp;to&amp;nbsp;stroke&amp;nbsp;a&amp;nbsp;sequence&amp;nbsp;of&amp;nbsp;line&amp;nbsp;segments. &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Equivalent&amp;nbsp;to&amp;nbsp;for(i=0;&amp;nbsp;i&amp;lt;count;&amp;nbsp;i+=2)&amp;nbsp;{&amp;nbsp;MoveToPoint(point[i]);&amp;nbsp;AddLineToPoint(point[i+1]);&amp;nbsp;StrokePath();&amp;nbsp;} &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextStrokeLineSegments(context,&amp;nbsp;strokeSegments,&amp;nbsp;sizeof(strokeSegments)/sizeof(strokeSegments[0]));&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;效果如下图：&lt;/p&gt;&lt;p&gt;&lt;img height="481" alt="iPhone绘图关于QuartZ中绘制Line案例" width="321" border="0" src="http://www.zhujiangroad.com/upload/2011/11/201111134458.png" /&gt;&lt;/p&gt;&lt;p&gt;2.画虚线&lt;/p&gt;&lt;ol&gt;&lt;li&gt;CGContextRef&amp;nbsp;context&amp;nbsp;=&amp;nbsp;UIGraphicsGetCurrentContext(); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextSetRGBStrokeColor(context,&amp;nbsp;1.0,&amp;nbsp;1.0,&amp;nbsp;1.0,&amp;nbsp;1.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Each&amp;nbsp;dash&amp;nbsp;entry&amp;nbsp;is&amp;nbsp;a&amp;nbsp;run-length&amp;nbsp;in&amp;nbsp;the&amp;nbsp;current&amp;nbsp;coordinate&amp;nbsp;system &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;The&amp;nbsp;concept&amp;nbsp;is&amp;nbsp;first&amp;nbsp;you&amp;nbsp;determine&amp;nbsp;how&amp;nbsp;many&amp;nbsp;points&amp;nbsp;in&amp;nbsp;the&amp;nbsp;current&amp;nbsp;system&amp;nbsp;you&amp;nbsp;need&amp;nbsp;to&amp;nbsp;fill. &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Then&amp;nbsp;you&amp;nbsp;start&amp;nbsp;consuming&amp;nbsp;that&amp;nbsp;many&amp;nbsp;pi&lt;a href="http://www.zhujiangroad.com/tag/8247.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;xe&lt;/a&gt;ls&amp;nbsp;in&amp;nbsp;the&amp;nbsp;dash&amp;nbsp;pattern&amp;nbsp;for&amp;nbsp;each&amp;nbsp;element&amp;nbsp;of&amp;nbsp;the&amp;nbsp;pattern. &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;So&amp;nbsp;for&amp;nbsp;example,&amp;nbsp;if&amp;nbsp;you&amp;nbsp;have&amp;nbsp;a&amp;nbsp;dash&amp;nbsp;pattern&amp;nbsp;of&amp;nbsp;{10,&amp;nbsp;10},&amp;nbsp;then&amp;nbsp;you&amp;nbsp;will&amp;nbsp;draw&amp;nbsp;10&amp;nbsp;points,&amp;nbsp;then&amp;nbsp;skip&amp;nbsp;10&amp;nbsp;points,&amp;nbsp;and&amp;nbsp;repeat. &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;As&amp;nbsp;another&amp;nbsp;example&amp;nbsp;if&amp;nbsp;your&amp;nbsp;dash&amp;nbsp;pattern&amp;nbsp;is&amp;nbsp;{10,&amp;nbsp;20,&amp;nbsp;30},&amp;nbsp;then&amp;nbsp;you&amp;nbsp;draw&amp;nbsp;10&amp;nbsp;points,&amp;nbsp;skip&amp;nbsp;20&amp;nbsp;points,&amp;nbsp;draw&amp;nbsp;30&amp;nbsp;points, &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;skip&amp;nbsp;10&amp;nbsp;points,&amp;nbsp;draw&amp;nbsp;20&amp;nbsp;points,&amp;nbsp;skip&amp;nbsp;30&amp;nbsp;points,&amp;nbsp;and&amp;nbsp;repeat. &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;The&amp;nbsp;dash&amp;nbsp;phase&amp;nbsp;factors&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/8301.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;into&lt;/a&gt;&amp;nbsp;this&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/7317.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;by&lt;/a&gt;&amp;nbsp;st&lt;a href="http://www.zhujiangroad.com/tag/477.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;ati&lt;/a&gt;ng&amp;nbsp;how&amp;nbsp;many&amp;nbsp;points&amp;nbsp;into&amp;nbsp;the&amp;nbsp;dash&amp;nbsp;pattern&amp;nbsp;to&amp;nbsp;skip. &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;So&amp;nbsp;given&amp;nbsp;a&amp;nbsp;dash&amp;nbsp;pattern&amp;nbsp;of&amp;nbsp;{10,&amp;nbsp;10}&amp;nbsp;with&amp;nbsp;a&amp;nbsp;phase&amp;nbsp;of&amp;nbsp;5,&amp;nbsp;you&amp;nbsp;would&amp;nbsp;draw&amp;nbsp;5&amp;nbsp;points&amp;nbsp;(since&amp;nbsp;phase&amp;nbsp;plus&amp;nbsp;5&amp;nbsp;yields&amp;nbsp;10&amp;nbsp;points), &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;then&amp;nbsp;skip&amp;nbsp;10,&amp;nbsp;draw&amp;nbsp;10,&amp;nbsp;skip&amp;nbsp;10,&amp;nbsp;draw&amp;nbsp;10,&amp;nbsp;etc. &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextSetLineDash(context,&amp;nbsp;dashPhase,&amp;nbsp;dashPattern,&amp;nbsp;dashCount); &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;Draw&amp;nbsp;a&amp;nbsp;horizontal&amp;nbsp;line,&amp;nbsp;vertical&amp;nbsp;line,&amp;nbsp;rectangle&amp;nbsp;and&amp;nbsp;circle&amp;nbsp;for&amp;nbsp;comparison &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextMoveToPoint(context,&amp;nbsp;10.0,&amp;nbsp;20.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextAddLineToPoint(context,&amp;nbsp;310.0,&amp;nbsp;20.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextMoveToPoint(context,&amp;nbsp;160.0,&amp;nbsp;30.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextAddLineToPoint(context,&amp;nbsp;160.0,&amp;nbsp;130.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextAddRect(context,&amp;nbsp;CGRectMake(10.0,&amp;nbsp;30.0,&amp;nbsp;&lt;a href="http://www.zhujiangroad.com/tag/2907.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;100&lt;/a&gt;.0,&amp;nbsp;100.0)); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextAddEllipseInRect(context,&amp;nbsp;CGRectMake(&lt;a href="http://www.zhujiangroad.com/tag/2502.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;210&lt;/a&gt;.0,&amp;nbsp;30.0,&amp;nbsp;100.0,&amp;nbsp;100.0)); &amp;nbsp;&lt;/li&gt;&lt;li&gt;//&amp;nbsp;And&amp;nbsp;width&amp;nbsp;2.0&amp;nbsp;so&amp;nbsp;they&amp;nbsp;are&amp;nbsp;a&amp;nbsp;bit&amp;nbsp;more&amp;nbsp;visible &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextSetLineWidth(context,&amp;nbsp;2.0); &amp;nbsp;&lt;/li&gt;&lt;li&gt;CGContextStrokePath(context);&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;其中CGFloat lengths[]是一个CGFloat&lt;a href="http://www.zhujiangroad.com/tag/7013.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;类型&lt;/a&gt;的&lt;a href="http://www.zhujiangroad.com/tag/4968.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;数组&lt;/a&gt;，dashCount表示数组元素的个数&amp;nbsp;&amp;nbsp;。下面将给出5种情况下虚线的&lt;a href="http://www.zhujiangroad.com/tag/5056.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;图片&lt;/a&gt;：&lt;/p&gt;&lt;p&gt;{{10.0, 10.0}, 2}如下图，先&lt;a href="http://www.zhujiangroad.com/tag/7880.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;默认&lt;/a&gt;dashPhase为0.&lt;/p&gt;&lt;p&gt;&lt;img height="165" alt="iPhone绘图关于QuartZ中绘制Line案例" width="320" border="0" src="http://www.zhujiangroad.com/upload/2011/11/20111113893.png" /&gt;&lt;/p&gt;&lt;p&gt;dash pattern为{10，10}表示的是先绘制10 points，然后跳过10 points，然后&lt;a href="http://www.zhujiangroad.com/tag/7069.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;重复&lt;/a&gt;，就向上图&amp;nbsp;&amp;nbsp;。&lt;/p&gt;&lt;p&gt;{{10.0, 20.0, 10.0}, 3}如下图：&lt;/p&gt;&lt;p&gt;&lt;img height="167" alt="iPhone绘图关于QuartZ中绘制Line案例" width="321" border="0" src="http://www.zhujiangroad.com/upload/2011/11/201111134244.png" /&gt;&lt;/p&gt;&lt;p&gt;这是一个奇数个的例子，就是先绘制10 points， 接着跳过20 points，再绘制10points，接着跳过10 points，再绘制20points，在跳过10 points，然后接着重复&amp;nbsp;&amp;nbsp;。&lt;/p&gt;&lt;p&gt;{{10.0, 20.0, 30.0}, 3},如下图&lt;/p&gt;&lt;p&gt;&lt;img height="158" alt="iPhone绘图关于QuartZ中绘制Line案例" width="319" border="0" src="http://www.zhujiangroad.com/upload/2011/11/201111131534.png" /&gt;&lt;/p&gt;&lt;p&gt;{{10.0, 20.0, 10.0, 30.0}, 4},如下图&lt;/p&gt;&lt;p&gt;&lt;img height="152" alt="iPhone绘图关于QuartZ中绘制Line案例" width="323" border="0" src="http://www.zhujiangroad.com/upload/2011/11/201111132322.png" /&gt;&lt;/p&gt;&lt;p&gt;{{10.0, 10.0, 20.0, 30.0, 50.0}, 5},如下图：&lt;/p&gt;&lt;p&gt;&lt;img height="154" alt="iPhone绘图关于QuartZ中绘制Line案例" width="316" border="0" src="http://www.zhujiangroad.com/upload/2011/11/201111137302.png" /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.zhujiangroad.com/tag/5876.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;函数&lt;/a&gt;CGContextSetLineDash的函数dashPhase&lt;a href="http://www.zhujiangroad.com/tag/3351.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;参数&lt;/a&gt;表示虚线在绘制的时候跳过多少个points&amp;nbsp;&amp;nbsp;。举一个例子，dash pattern为{10，10}，dashPhase为5，则我们绘制5 points，接着跳过10 points，绘制10， 跳过10 ，绘制10 &amp;nbsp;&amp;nbsp;。&amp;nbsp;&amp;nbsp;。&amp;nbsp;&amp;nbsp;。重复&amp;nbsp;&amp;nbsp;。&lt;/p&gt;&lt;p&gt;小结：&lt;strong&gt;iPhone绘图&lt;/strong&gt;关于&lt;strong&gt;QuartZ&lt;/strong&gt;中&lt;strong&gt;绘制&lt;/strong&gt;Line案例的内容介绍完了，希望本文对你有所&lt;a href="http://www.zhujiangroad.com/tag/6630.html" target="_blank" style="text-decoration: none; color: #07519a; "&gt;帮助&lt;/a&gt;！如果想深入了解&lt;strong&gt;iphone绘图&lt;/strong&gt;的更多内容，请参考：&lt;/p&gt;&lt;p&gt;iPhone绘图关于QuartZ中绘制Polygons案例&lt;/p&gt;&lt;p&gt;iPhone绘图关于QuartZ中绘制Curves案例&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2272239.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2011/12/02/2272239.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2011/12/02/2271607.html</id><title type="text">IOS开发网络篇之──ASIHTTPRequest详解</title><summary type="text">目录目录发起一个同步请求创建一个异步请求队列请求请求队列上下文ASINetworkQueues, 它的delegate提供更为丰富的功能取消异步请求安全的内存回收建议向服务器端上传数据下载文件获取响应信息获取请求进度cookie的支持大文件断点续传ASIDownloadCache 设置下载缓存多种的缓存并存缓存策略缓存存储方式缓存其它特性实现自定义的缓存使用代理请求ASIHTTPRequest, 请求的其它特性ASIHTTPRequest是一款极其强劲的HTTP访问开源项目。让简单的ＡＰＩ完成复杂的功能，如：异步请求，队列请求，GZIP压缩，缓存，断点续传，进度跟踪，上传文件，HTTP认证在新</summary><published>2011-12-02T01:10:00Z</published><updated>2011-12-02T01:10:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2011/12/02/2271607.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2011/12/02/2271607.html"/><content type="html">&lt;div&gt;&lt;div&gt;&lt;p&gt;&lt;strong&gt;目录&lt;/strong&gt;&lt;/p&gt;&lt;div style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E7%9B%AE%E5%BD%95" style="color: #336699; text-decoration: none; "&gt;目录&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%8F%91%E8%B5%B7%E4%B8%80%E4%B8%AA%E5%90%8C%E6%AD%A5%E8%AF%B7%E6%B1%82" style="color: #336699; text-decoration: none; "&gt;发起一个同步请求&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E5%BC%82%E6%AD%A5%E8%AF%B7%E6%B1%82" style="color: #336699; text-decoration: none; "&gt;创建一个异步请求&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E9%98%9F%E5%88%97%E8%AF%B7%E6%B1%82" style="color: #336699; text-decoration: none; "&gt;队列请求&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E8%AF%B7%E6%B1%82%E9%98%9F%E5%88%97%E4%B8%8A%E4%B8%8B%E6%96%87" style="color: #336699; text-decoration: none; "&gt;请求队列上下文&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-ASINetworkQueues%2C%E5%AE%83%E7%9A%84delegate%E6%8F%90%E4%BE%9B%E6%9B%B4%E4%B8%BA%E4%B8%B0%E5%AF%8C%E7%9A%84%E5%8A%9F%E8%83%BD" style="color: #336699; text-decoration: none; "&gt;ASINetworkQueues, 它的delegate提供更为丰富的功能&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%8F%96%E6%B6%88%E5%BC%82%E6%AD%A5%E8%AF%B7%E6%B1%82" style="color: #336699; text-decoration: none; "&gt;取消异步请求&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%AE%89%E5%85%A8%E7%9A%84%E5%86%85%E5%AD%98%E5%9B%9E%E6%94%B6%E5%BB%BA%E8%AE%AE" style="color: #336699; text-decoration: none; "&gt;安全的内存回收建议&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%90%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AB%AF%E4%B8%8A%E4%BC%A0%E6%95%B0%E6%8D%AE" style="color: #336699; text-decoration: none; "&gt;向服务器端上传数据&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6" style="color: #336699; text-decoration: none; "&gt;下载文件&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E8%8E%B7%E5%8F%96%E5%93%8D%E5%BA%94%E4%BF%A1%E6%81%AF" style="color: #336699; text-decoration: none; "&gt;获取响应信息&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E8%8E%B7%E5%8F%96%E8%AF%B7%E6%B1%82%E8%BF%9B%E5%BA%A6" style="color: #336699; text-decoration: none; "&gt;获取请求进度&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-cookie%E7%9A%84%E6%94%AF%E6%8C%81" style="color: #336699; text-decoration: none; "&gt;cookie的支持&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%A4%A7%E6%96%87%E4%BB%B6%E6%96%AD%E7%82%B9%E7%BB%AD%E4%BC%A0" style="color: #336699; text-decoration: none; "&gt;大文件断点续传&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-ASIDownloadCache%E8%AE%BE%E7%BD%AE%E4%B8%8B%E8%BD%BD%E7%BC%93%E5%AD%98" style="color: #336699; text-decoration: none; "&gt;ASIDownloadCache 设置下载缓存&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%A4%9A%E7%A7%8D%E7%9A%84%E7%BC%93%E5%AD%98%E5%B9%B6%E5%AD%98" style="color: #336699; text-decoration: none; "&gt;多种的缓存并存&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E7%BC%93%E5%AD%98%E7%AD%96%E7%95%A5" style="color: #336699; text-decoration: none; "&gt;缓存策略&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E7%BC%93%E5%AD%98%E5%AD%98%E5%82%A8%E6%96%B9%E5%BC%8F" style="color: #336699; text-decoration: none; "&gt;缓存存储方式&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E7%BC%93%E5%AD%98%E5%85%B6%E5%AE%83%E7%89%B9%E6%80%A7" style="color: #336699; text-decoration: none; "&gt;缓存其它特性&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%AE%9A%E4%B9%89%E7%9A%84%E7%BC%93%E5%AD%98" style="color: #336699; text-decoration: none; "&gt;实现自定义的缓存&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E4%BD%BF%E7%94%A8%E4%BB%A3%E7%90%86%E8%AF%B7%E6%B1%82" style="color: #336699; text-decoration: none; "&gt;使用代理请求&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.magiche.net/pages/viewpage.action?pageId=2064410#ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-ASIHTTPRequest%2C%E8%AF%B7%E6%B1%82%E7%9A%84%E5%85%B6%E5%AE%83%E7%89%B9%E6%80%A7" style="color: #336699; text-decoration: none; "&gt;ASIHTTPRequest, 请求的其它特性&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p&gt;ASIHTTPRequest是一款极其强劲的HTTP访问开源项目。让简单的ＡＰＩ完成复杂的功能，&lt;/p&gt;&lt;p&gt;如：&lt;br /&gt;异步请求，队列请求，GZIP压缩，缓存，断点续传，进度跟踪，上传文件，HTTP认证&lt;br /&gt;在新的版本中，还加入了Objective-C闭包Block的支持，让我们的代码更加轻简灵活。&lt;/p&gt;&lt;p&gt;下面就举例说明它的API用法。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%8F%91%E8%B5%B7%E4%B8%80%E4%B8%AA%E5%90%8C%E6%AD%A5%E8%AF%B7%E6%B1%82" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;发起一个同步请求&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;同步意为着线程阻塞，在主线程中使用此方法会使应用Hang住而不响应任何用户事件。所以，在应用程序设计时，大多被用在专门的子线程增加用户体验，或用异步请求代替（下面会讲到）。&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_186170" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;- (IBAction)grabURL:(id)sender&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSURL *url = [NSURL URLWithString:@&lt;/code&gt;&lt;code string"=""&gt;"&lt;a href="http://allseeing-i.com/" style="color: #336699; text-decoration: none; "&gt;http://allseeing-i.com"&lt;/a&gt;&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request startSynchronous];&lt;/code&gt;&lt;/div&gt;&lt;div number6="" index5=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSError *error = [request error];&lt;/code&gt;&lt;/div&gt;&lt;div number7="" index6=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code keyword"=""&gt;if&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;(!error) {&lt;/code&gt;&lt;/div&gt;&lt;div number8="" index7=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSString *response = [request responseString];&lt;/code&gt;&lt;/div&gt;&lt;div number9="" index8=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div number10="" index9=""  alt1"=""&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;a, 用requestWithURL快捷方法获取ASIHTTPRequest的一个实例&lt;br /&gt;b, startSynchronous 方法启动同步访问，&lt;br /&gt;c, 由于是同步请求，没有基于事件的回调方法，所以从request的error属性获取错误信息。&lt;br /&gt;d, responseString，为请求的返回NSString信息。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E5%BC%82%E6%AD%A5%E8%AF%B7%E6%B1%82" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;创建一个异步请求&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;异步请求的好处是不阻塞当前线程，但相对于同步请求略为复杂，至少要添加两个回调方法来获取异步事件。&lt;br /&gt;下面异步请求代码完成上面同样的一件事情：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_454372" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;- (IBAction)grabURLInBackground:(id)sender&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSURL *url = [NSURL URLWithString:@&lt;/code&gt;&lt;code string"=""&gt;"&lt;a href="http://allseeing-i.com/" style="color: #336699; text-decoration: none; "&gt;http://allseeing-i.com"&lt;/a&gt;&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request setDelegate:self];&lt;/code&gt;&lt;/div&gt;&lt;div number6="" index5=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request startAsynchronous];&lt;/code&gt;&lt;/div&gt;&lt;div number7="" index6=""  alt2"=""&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div number8="" index7=""  alt1"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number9="" index8=""  alt2"=""&gt;&lt;code plain"=""&gt;- (&lt;/code&gt;&lt;code keyword"=""&gt;void&lt;/code&gt;&lt;code plain"=""&gt;)requestFinished:(ASIHTTPRequest *)request&lt;/code&gt;&lt;/div&gt;&lt;div number10="" index9=""  alt1"=""&gt;&lt;code plain"=""&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div number11="" index10=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code comments"=""&gt;// Use when fetching text data&lt;/code&gt;&lt;/div&gt;&lt;div number12="" index11=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSString *responseString = [request responseString];&lt;/code&gt;&lt;/div&gt;&lt;div number13="" index12=""  alt2"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number14="" index13=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code comments"=""&gt;// Use when fetching binary data&lt;/code&gt;&lt;/div&gt;&lt;div number15="" index14=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSData *responseData = [request responseData];&lt;/code&gt;&lt;/div&gt;&lt;div number16="" index15=""  alt1"=""&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div number17="" index16=""  alt2"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number18="" index17=""  alt1"=""&gt;&lt;code plain"=""&gt;- (&lt;/code&gt;&lt;code keyword"=""&gt;void&lt;/code&gt;&lt;code plain"=""&gt;)requestFailed:(ASIHTTPRequest *)request&lt;/code&gt;&lt;/div&gt;&lt;div number19="" index18=""  alt2"=""&gt;&lt;code plain"=""&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div number20="" index19=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSError *error = [request error];&lt;/code&gt;&lt;/div&gt;&lt;div number21="" index20=""  alt2"=""&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;a，与上面不同的地方是指定了一个 "delegate"，并用startAsynchronous来启动网络请求。&lt;br /&gt;b，在这里实现了两个delegate的方法，当数据请求成功时会调用requestFinished，请求失败时（如网络问题或服务器内部错误）会调用requestFailed。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E9%98%9F%E5%88%97%E8%AF%B7%E6%B1%82" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;队列请求&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;提供了一个对异步请求更加精准丰富的控制。&lt;br /&gt;如，可以设置在队列中，同步请求的连接数。往队列里添加的请求实例数大于maxConcurrentOperationCount时，请求实例将被置为等待，直到前面至少有一个请求完成并出列才被放到队列里执行。&lt;br /&gt;也适用于当我们有多个请求需求按顺序执行的时候（可能是业务上的需要，也可能是软件上的调优），仅仅需要把maxConcurrentOperationCount设为&amp;#8220;1&amp;#8221;。&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_778666" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;- (IBAction)grabURLInTheBackground:(id)sender&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code keyword"=""&gt;if&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;(![self queue]) {&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[self setQueue:[[[NSOperationQueue alloc] init] autorelease]];&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div number6="" index5=""  alt1"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number7="" index6=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSURL *url = [NSURL URLWithString:@&lt;/code&gt;&lt;code string"=""&gt;"&lt;a href="http://allseeing-i.com/" style="color: #336699; text-decoration: none; "&gt;http://allseeing-i.com"&lt;/a&gt;&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number8="" index7=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];&lt;/code&gt;&lt;/div&gt;&lt;div number9="" index8=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request setDelegate:self];&lt;/code&gt;&lt;/div&gt;&lt;div number10="" index9=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request setDidFinishSelector:&lt;/code&gt;&lt;code color1"=""&gt;@selector&lt;/code&gt;&lt;code plain"=""&gt;(requestDone:)];&lt;/code&gt;&lt;/div&gt;&lt;div number11="" index10=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request setDidFailSelector:&lt;/code&gt;&lt;code color1"=""&gt;@selector&lt;/code&gt;&lt;code plain"=""&gt;(requestWentWrong:)];&lt;/code&gt;&lt;/div&gt;&lt;div number12="" index11=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[[self queue] addOperation:request];&amp;nbsp;&lt;/code&gt;&lt;code comments"=""&gt;//queue is an NSOperationQueue&lt;/code&gt;&lt;/div&gt;&lt;div number13="" index12=""  alt2"=""&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div number14="" index13=""  alt1"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number15="" index14=""  alt2"=""&gt;&lt;code plain"=""&gt;- (&lt;/code&gt;&lt;code keyword"=""&gt;void&lt;/code&gt;&lt;code plain"=""&gt;)requestDone:(ASIHTTPRequest *)request&lt;/code&gt;&lt;/div&gt;&lt;div number16="" index15=""  alt1"=""&gt;&lt;code plain"=""&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div number17="" index16=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSString *response = [request responseString];&lt;/code&gt;&lt;/div&gt;&lt;div number18="" index17=""  alt1"=""&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div number19="" index18=""  alt2"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number20="" index19=""  alt1"=""&gt;&lt;code plain"=""&gt;- (&lt;/code&gt;&lt;code keyword"=""&gt;void&lt;/code&gt;&lt;code plain"=""&gt;)requestWentWrong:(ASIHTTPRequest *)request&lt;/code&gt;&lt;/div&gt;&lt;div number21="" index20=""  alt2"=""&gt;&lt;code plain"=""&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div number22="" index21=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;NSError *error = [request error];&lt;/code&gt;&lt;/div&gt;&lt;div number23="" index22=""  alt2"=""&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;创建NSOperationQueue，这个Cocoa架构的执行任务（NSOperation）的任务队列。我们通过ASIHTTPRequest.h的源码可以看到，此类本身就是一个NSOperation的子类。也就是说它可以直接被放到"任务队列"中，并被执行。上面的代码队了队列的创建与添加操作外，其它代码与上一例一样。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E8%AF%B7%E6%B1%82%E9%98%9F%E5%88%97%E4%B8%8A%E4%B8%8B%E6%96%87" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;请求队列上下文&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;a，可以设置一个上下文（userInfo）到request对象中，当请求响应完后可以通过访问request对象的userInfo获取里面的信息&lt;br /&gt;b，为每一个请求实例设置不同的setDidFinishSelector / setDidFailSelector的回调方法&lt;br /&gt;c，子类化ASIHTTPRequest，重写requestFinished: 与 failWithProblem:方法&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-ASINetworkQueues%2C%E5%AE%83%E7%9A%84delegate%E6%8F%90%E4%BE%9B%E6%9B%B4%E4%B8%BA%E4%B8%B0%E5%AF%8C%E7%9A%84%E5%8A%9F%E8%83%BD" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;ASINetworkQueues, 它的delegate提供更为丰富的功能&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;提供的更多的回调方法如下：&lt;br /&gt;a，requestDidStartSelector，请求发起时会调此方法，你可以在此方法中跟据业务选择性的设置request对象的deleaget。&lt;br /&gt;b，requestDidReceiveResponseHeadersSelector，当接受完响应的Header后设计此方法，这个对下载大数据的时候相当有用，你可以在方法里做更多业务上的处理。&lt;br /&gt;c，requestDidFinishSelector，请求并响应成功完成时调用此方法&lt;br /&gt;d，requestDidFailSelector，请求失败&lt;br /&gt;e，queueDidFinishSelector，整个队列里的所有请求都结束时调用此方法。&lt;/p&gt;&lt;div style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;table border="0"&gt;&lt;colgroup&gt;&lt;col width="24"&gt;&lt;col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;img src="http://wiki.magiche.net/images/icons/emoticons/check.gif" border="0" alt="" width="16" height="16" align="absmiddle" style="border-width: initial; border-color: initial; " /&gt;&lt;/td&gt;&lt;td&gt;它是NSOperationQueues的扩展，小而强大。但也与它的父类略有区别。如，仅添加到队列中其实并不能执行请求，只有调用[ queue g o]才会执行；一个正在运行中的队列，并不需要重复调用[ queue go ]。&lt;p&gt;默认情况下，队列中的一个请求如果失败，它会取消所有未完成的请求。可以设置[ queue setShouldCancelAllRequestsOnFailure:NO ]来修 正。&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%8F%96%E6%B6%88%E5%BC%82%E6%AD%A5%E8%AF%B7%E6%B1%82" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;取消异步请求&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;首先，同步请求是不能取消的。&lt;br /&gt;其次，不管是队列请求，还是简单的异步请求，全部调用[ request cancel ]来取消请求。&lt;/p&gt;&lt;div style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;table border="0"&gt;&lt;colgroup&gt;&lt;col width="24"&gt;&lt;col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;img src="http://wiki.magiche.net/images/icons/emoticons/check.gif" border="0" alt="" width="16" height="16" align="absmiddle" style="border-width: initial; border-color: initial; " /&gt;&lt;/td&gt;&lt;td&gt;取消的请求默认都会按请求失败处理，并调用请求失败delegate。&lt;br /&gt;如果不想调用delegate方法，则设置：[ request clearDelegatesAndCancel];&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;队列请求中需要注意的是，如果你取消了一个请求，队列会自动取消其它所有请求。&lt;br /&gt;如果只想取消一个请求，可以设置队列：[ queue setShouldCancelAllRequestsOnFailure:NO ];&lt;br /&gt;如果想明确取消所有请求：[ queue cancelAllOperations ];&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%AE%89%E5%85%A8%E7%9A%84%E5%86%85%E5%AD%98%E5%9B%9E%E6%94%B6%E5%BB%BA%E8%AE%AE" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;安全的内存回收建议&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;request并没有retain你的delegate，所以在没有请求完的时候释放了此delegate，需要在dealloc方法里先取消所有请求，再释放请求实例，如：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_532512" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;- (&lt;/code&gt;&lt;code keyword"=""&gt;void&lt;/code&gt;&lt;code plain"=""&gt;)dealloc&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;{&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request clearDelegatesAndCancel];&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request release];&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;...&lt;/code&gt;&lt;/div&gt;&lt;div number6="" index5=""  alt1"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[&lt;/code&gt;&lt;code keyword"=""&gt;super&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;dealloc];&lt;/code&gt;&lt;/div&gt;&lt;div number7="" index6=""  alt2"=""&gt;&lt;code plain"=""&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%90%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AB%AF%E4%B8%8A%E4%BC%A0%E6%95%B0%E6%8D%AE" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;向服务器端上传数据&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;ASIFormDataRequest ，模拟 Form表单提交，其提交格式与 Header会自动识别。&lt;br /&gt;没有文件：application/x-www-form-urlencoded&lt;br /&gt;有文件：multipart/form-data&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_71459" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;[request setPostValue:@&lt;/code&gt;&lt;code string"=""&gt;"Ben"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;forKey:@&lt;/code&gt;&lt;code string"=""&gt;"first_name"&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code plain"=""&gt;[request setPostValue:@&lt;/code&gt;&lt;code string"=""&gt;"Copsey"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;forKey:@&lt;/code&gt;&lt;code string"=""&gt;"last_name"&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code plain"=""&gt;[request setFile:@&lt;/code&gt;&lt;code string"=""&gt;"/Users/ben/Desktop/ben.jpg"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;forKey:@&lt;/code&gt;&lt;code string"=""&gt;"photo"&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code plain"=""&gt;[request addData:imageData withFileName:@&lt;/code&gt;&lt;code string"=""&gt;"george.jpg"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;andContentType:@&lt;/code&gt;&lt;code string"=""&gt;"image/jpeg"&lt;/code&gt;&lt;code plain"=""&gt;forKey:@&lt;/code&gt;&lt;code string"=""&gt;"photos"&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;如果要发送自定义数据：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_585339" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;[request appendPostData:[@&lt;/code&gt;&lt;code string"=""&gt;"This is my data"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;dataUsingEncoding:NSUTF8StringEncoding]];&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code comments"=""&gt;// Default becomes POST when you use appendPostData: / appendPostDataFromFile: / setPostBody:&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code plain"=""&gt;[request setRequestMethod:@&lt;/code&gt;&lt;code string"=""&gt;"PUT"&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;下载文件&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;通过设置request的setDownloadDestinationPath，可以设置下载文件用的下载目标目录。&lt;br /&gt;首先，下载过程文件会保存在temporaryFileDownloadPath目录下。如果下载完成会做以下事情：&lt;br /&gt;1，如果数据是压缩的，进行解压，并把文件放在downloadDestinationPath目录中，临时文件被删除&lt;br /&gt;2，如果下载失败，临时文件被直接移到downloadDestinationPath目录，并替换同名文件。&lt;/p&gt;&lt;p&gt;如果你想获取下载中的所有数据，可以实现delegate中的request:didReceiveData:方法。但如果你实现了这个方法，request在下载完后，request并不把文件放在downloadDestinationPath中，需要手工处理。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E8%8E%B7%E5%8F%96%E5%93%8D%E5%BA%94%E4%BF%A1%E6%81%AF" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;获取响应信息&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;信息：status , header, responseEncoding&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_840654" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[request responseStatusCode];&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;[[request responseHeaders] objectForKey:@&lt;/code&gt;&lt;code string"=""&gt;"X-Powered-By"&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code spaces"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;code plain"=""&gt;[request responseEncoding];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E8%8E%B7%E5%8F%96%E8%AF%B7%E6%B1%82%E8%BF%9B%E5%BA%A6" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;获取请求进度&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;有两个回调方法可以获取请求进度，&lt;br /&gt;1，downloadProgressDelegate，可以获取下载进度&lt;br /&gt;2，uploadProgressDelegate，可以获取上传进度&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-cookie%E7%9A%84%E6%94%AF%E6%8C%81" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;cookie的支持&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;如果Cookie存在的话，会把这些信息放在NSHTTPCookieStorage容器中共享，并供下次使用。&lt;br /&gt;你可以用[ ASIHTTPRequest setSessionCookies:nil ] ; 清空所有Cookies。&lt;br /&gt;当然，你也可以取消默认的Cookie策略，而使自定义的Cookie：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_996162" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code comments"=""&gt;//Create a cookie&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;NSDictionary *properties = [[[NSMutableDictionary alloc] init] autorelease];&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code plain"=""&gt;[properties setValue:[@&lt;/code&gt;&lt;code string"=""&gt;"Test Value"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;encodedCookieValue] forKey:NSHTTPCookieValue];&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code plain"=""&gt;[properties setValue:@&lt;/code&gt;&lt;code string"=""&gt;"ASIHTTPRequestTestCookie"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;forKey:NSHTTPCookieName];&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code plain"=""&gt;[properties setValue:@&lt;/code&gt;&lt;code string"=""&gt;".allseeing-i.com"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;forKey:NSHTTPCookieDomain];&lt;/code&gt;&lt;/div&gt;&lt;div number6="" index5=""  alt1"=""&gt;&lt;code plain"=""&gt;[properties setValue:[NSDate dateWithTimeIntervalSinceNow:&lt;/code&gt;&lt;code value"=""&gt;60&lt;/code&gt;&lt;code plain"=""&gt;*&lt;/code&gt;&lt;code value"=""&gt;60&lt;/code&gt;&lt;code plain"=""&gt;] forKey:NSHTTPCookieExpires];&lt;/code&gt;&lt;/div&gt;&lt;div number7="" index6=""  alt2"=""&gt;&lt;code plain"=""&gt;[properties setValue:@&lt;/code&gt;&lt;code string"=""&gt;"/asi-http-request/tests"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;forKey:NSHTTPCookiePath];&lt;/code&gt;&lt;/div&gt;&lt;div number8="" index7=""  alt1"=""&gt;&lt;code plain"=""&gt;NSHTTPCookie *cookie = [[[NSHTTPCookie alloc] initWithProperties:properties] autorelease];&lt;/code&gt;&lt;/div&gt;&lt;div number9="" index8=""  alt2"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number10="" index9=""  alt1"=""&gt;&lt;code comments"=""&gt;//This url will return the value of the 'ASIHTTPRequestTestCookie' cookie&lt;/code&gt;&lt;/div&gt;&lt;div number11="" index10=""  alt2"=""&gt;&lt;code plain"=""&gt;url = [NSURL URLWithString:@&lt;/code&gt;&lt;code string"=""&gt;"&lt;a href="http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie" style="color: #336699; text-decoration: none; "&gt;http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie"&lt;/a&gt;&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number12="" index11=""  alt1"=""&gt;&lt;code plain"=""&gt;request = [ASIHTTPRequest requestWithURL:url];&lt;/code&gt;&lt;/div&gt;&lt;div number13="" index12=""  alt2"=""&gt;&lt;code plain"=""&gt;[request setUseCookiePersistence:NO];&lt;/code&gt;&lt;/div&gt;&lt;div number14="" index13=""  alt1"=""&gt;&lt;code plain"=""&gt;[request setRequestCookies:[NSMutableArray arrayWithObject:cookie]];&lt;/code&gt;&lt;/div&gt;&lt;div number15="" index14=""  alt2"=""&gt;&lt;code plain"=""&gt;[request startSynchronous];&lt;/code&gt;&lt;/div&gt;&lt;div number16="" index15=""  alt1"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number17="" index16=""  alt2"=""&gt;&lt;code comments"=""&gt;//Should be: I have 'Test Value' as the value of 'ASIHTTPRequestTestCookie'&lt;/code&gt;&lt;/div&gt;&lt;div number18="" index17=""  alt1"=""&gt;&lt;code plain"=""&gt;NSLog(@&lt;/code&gt;&lt;code string"=""&gt;"%@"&lt;/code&gt;&lt;code plain"=""&gt;,[request responseString]);&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%A4%A7%E6%96%87%E4%BB%B6%E6%96%AD%E7%82%B9%E7%BB%AD%E4%BC%A0" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;大文件断点续传&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;0.94以后支持大文件的断点下载，只需要设置：&lt;br /&gt;[ request setAllowResumeForFileDownloads:YES ];&lt;br /&gt;[ request setDownloadDestinationPath:downloadPath ];&lt;br /&gt;就可以了。&lt;/p&gt;&lt;p&gt;ASIHTTPRequest会自动保存访问过的ＵＲＬ信息，并备之后用。在以下几个场景非常有用：&lt;br /&gt;1，当没有网络连接的时候。&lt;br /&gt;2，已下载的数据再次请求时，仅当它与本地版本不样时才进行下载。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-ASIDownloadCache%E8%AE%BE%E7%BD%AE%E4%B8%8B%E8%BD%BD%E7%BC%93%E5%AD%98" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;ASIDownloadCache 设置下载缓存&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;它对Get请求的响应数据进行缓存（被缓存的数据必需是成功的200请求）：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_363482" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;当设置缓存策略后，所有的请求都被自动的缓存起来。&lt;br /&gt;另外，如果仅仅希望某次请求使用缓存操作，也可以这样使用：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_369440" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;[request setDownloadCache:[ASIDownloadCache sharedCache]];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%A4%9A%E7%A7%8D%E7%9A%84%E7%BC%93%E5%AD%98%E5%B9%B6%E5%AD%98" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;多种的缓存并存&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;仅仅需要创建不同的ASIDownloadCache，并设置缓存所使用的路径，并设置到需要使用的request实例中：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_235676" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;ASIDownloadCache *cache = [[[ASIDownloadCache alloc] init] autorelease];&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;[cache setStoragePath:@&lt;/code&gt;&lt;code string"=""&gt;"/Users/ben/Documents/Cached-Downloads"&lt;/code&gt;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code plain"=""&gt;[self setMyCache:cache];&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code plain"=""&gt;ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code plain"=""&gt;[request setDownloadCache:[self myCache]];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E7%BC%93%E5%AD%98%E7%AD%96%E7%95%A5" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;缓存策略&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;缓存策略是我们控制缓存行为的主要方式，如：什么时候进行缓存，缓存数据的利用方式。&lt;br /&gt;以下是策略可选列表（可组合使用）：&lt;/p&gt;&lt;div style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;table border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;ASIUseDefaultCachePolicy&lt;/th&gt;&lt;td&gt;这是一个默认的缓存策略&amp;#8220;ASIAskServerIfModifiedWhenStaleCachePolicy&amp;#8221;，这个很明白，见名知意（它不能与其它策略组合使用）&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;ASIDoNotReadFromCacheCachePolicy&lt;/th&gt;&lt;td&gt;所读数据不使用缓存&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;ASIDoNotWriteToCacheCachePolicy&lt;/th&gt;&lt;td&gt;不对缓存数据进行写操作&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;ASIAskServerIfModifiedWhenStaleCachePolicy&lt;/th&gt;&lt;td&gt;默认缓存行为，request会先判断是否存在缓存数据。a, 如果没有再进行网络请求。 b，如果存在缓存数据，并且数据没有过期，则使用缓存。c，如果存在缓存数据，但已经过期，request会先进行网络请求，判断服务器版本与本地版本是否一样，如果一样，则使用缓存。如果服务器有新版本，会进行网络请求，并更新本地缓存&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;ASIAskServerIfModifiedCachePolicy&lt;/th&gt;&lt;td&gt;与默认缓存大致一样，区别仅是每次请求都会 去服务器判断是否有更新&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;ASIOnlyLoadIfNotCachedCachePolicy&lt;/th&gt;&lt;td&gt;如果有缓存在本地，不管其过期与否，总会拿来使用&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;ASIDontLoadCachePolicy&lt;/th&gt;&lt;td&gt;仅当有缓存的时候才会被正确执行，如果没有缓存，request将被取消（没有错误信息）&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;ASIFallbackToCacheIfLoadFailsCachePolicy&lt;/th&gt;&lt;td&gt;这个选项经常被用来与其它选项组合使用。请求失败时，如果有缓存当网络则返回本地缓存信息（这个在处理异常时非常有用）&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;table border="0"&gt;&lt;colgroup&gt;&lt;col width="24"&gt;&lt;col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;img src="http://wiki.magiche.net/images/icons/emoticons/check.gif" border="0" alt="" width="16" height="16" align="absmiddle" style="border-width: initial; border-color: initial; " /&gt;&lt;/td&gt;&lt;td&gt;如果设置了&amp;#8220;defaultCachePolicy&amp;#8221;则所有的请求都会使用此缓存。&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E7%BC%93%E5%AD%98%E5%AD%98%E5%82%A8%E6%96%B9%E5%BC%8F" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;缓存存储方式&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;你可以设置缓存的数据需要保存多长时间，ASIHTTPRequest提供了两种策略：&lt;br /&gt;a，ASICacheForSessionDurationCacheStoragePolicy，默认策略，基于session的缓存数据存储。当下次运行或[ASIHTTPRequest clearSession]时，缓存将失效。&lt;br /&gt;b，ASICachePermanentlyCacheStoragePolicy，把缓存数据永久保存在本地，&lt;br /&gt;如：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_103567" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;ASIHTTPRequest *request = [ ASIHTTPRequest requestWithURL:url ];&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;[ request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy ];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;另外，也可以使用clearCachedResponsesForStoragePolicy来清空指定策略下的缓存数据。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E7%BC%93%E5%AD%98%E5%85%B6%E5%AE%83%E7%89%B9%E6%80%A7" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;缓存其它特性&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;设置是否按服务器在Header里指定的是否可被缓存或过期策略进行缓存：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_331858" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[[ ASIDownloadCache sharedCache ] setShouldRespectCacheControlHeaders:NO ];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;设置request缓存的有效时间:&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_914818" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[ request setSecondsToCache:&lt;/code&gt;&lt;code value"=""&gt;60&lt;/code&gt;&lt;code plain"=""&gt;*&lt;/code&gt;&lt;code value"=""&gt;60&lt;/code&gt;&lt;code plain"=""&gt;*&lt;/code&gt;&lt;code value"=""&gt;24&lt;/code&gt;&lt;code plain"=""&gt;*&lt;/code&gt;&lt;code value"=""&gt;30&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;];&amp;nbsp;&lt;/code&gt;&lt;code comments"=""&gt;// 缓存30天&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;可以判断数据是否从缓存读取：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_692239" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[ request didUseCachedResponse ];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;设置缓存所使用的路径：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_464339" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[ request setDownloadDestinationPath:[[ ASIDownloadCache sharedCache ] pathToStoreCachedResponseDataForRequest:request ]];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%AE%9A%E4%B9%89%E7%9A%84%E7%BC%93%E5%AD%98" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;实现自定义的缓存&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;只要简单的实现ASICacheDelegate接口就可以被用来使用。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-%E4%BD%BF%E7%94%A8%E4%BB%A3%E7%90%86%E8%AF%B7%E6%B1%82" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;使用代理请求&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;默认的情况下，ASIHTTPRequest会使用被设置的默认代理。但你也可以手动修改http代理：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_282862" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code comments"=""&gt;// Configure a proxy server manually&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;NSURL *url = [ NSURL URLWithString:@&lt;/code&gt;&lt;code string"=""&gt;"&lt;a href="http://allseeing-i.com/ignore" style="color: #336699; text-decoration: none; "&gt;http://allseeing-i.com/ignore"&lt;/a&gt;&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code plain"=""&gt;ASIHTTPRequest *request = [ ASIHTTPRequest requestWithURL:url ];&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code plain"=""&gt;[ request setProxyHost:@&lt;/code&gt;&lt;code string"=""&gt;"192.168.0.1"&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code plain"=""&gt;[ request setProxyPort:&lt;/code&gt;&lt;code value"=""&gt;3128&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number6="" index5=""  alt1"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number7="" index6=""  alt2"=""&gt;&lt;code comments"=""&gt;// Alternatively, you can use a manually-specified Proxy Auto Config file (PAC)&lt;/code&gt;&lt;/div&gt;&lt;div number8="" index7=""  alt1"=""&gt;&lt;code comments"=""&gt;// (It's probably best if you use a local file)&lt;/code&gt;&lt;/div&gt;&lt;div number9="" index8=""  alt2"=""&gt;&lt;code plain"=""&gt;[request setPACurl:[NSURL URLWithString:@&lt;/code&gt;&lt;code string"=""&gt;"file:///Users/ben/Desktop/test.pac"&lt;/code&gt;&lt;code plain"=""&gt;]];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="ASIHTTPRequest%E8%AF%A6%E8%A7%A3%2Chttp%E8%AF%B7%E6%B1%82%E7%BB%88%E7%BB%93%E8%80%85-ASIHTTPRequest%2C%E8%AF%B7%E6%B1%82%E7%9A%84%E5%85%B6%E5%AE%83%E7%89%B9%E6%80%A7" style="color: rgb(51, 102, 153); "&gt;&lt;/a&gt;ASIHTTPRequest, 请求的其它特性&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;iOS4中，当应用后台运行时仍然请求数据：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_268770" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[ request setShouldContinueWhenAppEntersBackground:YES ];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;是否有网络请求：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_990069" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[ ASIHTTPRequest isNetworkInUse ]&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;是否显示网络请求信息在status bar上：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_52598" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[ ASIHTTPRequest setShouldUpdateNetworkActivityIndicator:NO ];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;设置请求超时时，设置重试的次数：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_985461" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code plain"=""&gt;[ request setNumberOfTimesToRetryOnTimeout:&lt;/code&gt;&lt;code value"=""&gt;2&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;KeepAlive的支持：&lt;/p&gt;&lt;div panel"="" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 7px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #dddddd; border-right-color: #dddddd; border-bottom-color: #dddddd; border-left-color: #dddddd; border-image: initial; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; "&gt;&lt;div panelcontent"=""&gt;&lt;div&gt;&lt;div id="highlighter_72727" nogutter=""  java"=""&gt;&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div title="Hint: double-click to select code"&gt;&lt;div number1="" index0=""  alt2"=""&gt;&lt;code comments"=""&gt;// Set the amount of time to hang on to a persistent connection before it should expire to 2 minutes&lt;/code&gt;&lt;/div&gt;&lt;div number2="" index1=""  alt1"=""&gt;&lt;code plain"=""&gt;[ request setPersistentConnectionTimeoutSeconds:&lt;/code&gt;&lt;code value"=""&gt;120&lt;/code&gt;&amp;nbsp;&lt;code plain"=""&gt;];&lt;/code&gt;&lt;/div&gt;&lt;div number3="" index2=""  alt2"=""&gt;&lt;code plain"=""&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;&lt;div number4="" index3=""  alt1"=""&gt;&lt;code comments"=""&gt;// Disable persistent connections entirely&lt;/code&gt;&lt;/div&gt;&lt;div number5="" index4=""  alt2"=""&gt;&lt;code plain"=""&gt;[ request setShouldAttemptPersistentConnection:NO ];&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2271607.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2011/12/02/2271607.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2011/11/26/2264652.html</id><title type="text">ios5 中文键盘高度变高覆盖现有ui问题的解决方案（获取键盘高度的方法）</title><summary type="text">背景： ios5之前，iphone上的键盘的高度是固定为216.0px高的，中文汉字的选择框是悬浮的，所以不少应用都将此高度来标注键盘的高度（包括米聊也是这么做的）。 可是在ios5中，键盘布局变了，尤其是中文输入时，中文汉字选择框就固定在键盘上方，这样就使得原本与键盘紧密贴合的界面视图被中文汉字选择框给覆盖住了。一方面影响了界面的美观，另一方面，如果被覆盖的部分就是文本输入框的话，用户就无法看到输入的内容了。因此这个问题就必须得解决了。解决方法： 其实在一开始使用216.0px这个固定值来标注键盘的高度就是错误的。因为在ios3.2以后的系统中，苹果就提供了键盘使用的api以及demo...</summary><published>2011-11-26T13:51:00Z</published><updated>2011-11-26T13:51:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2011/11/26/2264652.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2011/11/26/2264652.html"/><content type="html">&lt;div&gt;&lt;p&gt;背景：&lt;/p&gt;&lt;p&gt;ios5之前，iphone上的键盘的高度是固定为216.0px高的，中文汉字的选择框是悬浮的，所以不少应用都将此高度来标注键盘的高度（包括米聊也是这么做的）。&lt;/p&gt;&lt;p&gt;可是在ios5中，键盘布局变了，尤其是中文输入时，中文汉字选择框就固定在键盘上方，这样就使得原本与键盘紧密贴合的界面视图被中文汉字选择框给覆盖住了。一方面影响了界面的美观，另一方面，如果被覆盖的部分就是文本输入框的话，用户就无法看到输入的内容了。因此这个问题就必须得解决了。&lt;/p&gt;&lt;p&gt;解决方法：&lt;/p&gt;&lt;p&gt;其实在一开始使用216.0px这个固定值来标注键盘的高度就是错误的。因为在ios3.2以后的系统中，苹果就提供了键盘使用的api以及demo程序&amp;#8212;&amp;#8212;&amp;#8220;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.8em; direction: ltr; "&gt;KeyboardAccessory&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.8em; direction: ltr; "&gt;&amp;#8221;。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.8em; direction: ltr; "&gt;处理键盘事件的正确方法是这样的：（包括获取键盘的高度以及键盘弹出和消失动画的时间）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.8em; direction: ltr; "&gt;1）在要使用键盘的视图控制器中，接收键盘事件的通知：&lt;/span&gt;&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: #ffffff; font-size: 12px; color: #111111; line-height: 23px; "&gt;        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;object&lt;/span&gt;:nil];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;object&lt;/span&gt;:nil];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;        &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;//&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt; 键盘高度变化通知，ios5.0新增的  &lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;#ifdef&lt;/span&gt; __IPHONE_5_0&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;        &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;float&lt;/span&gt; version = [[[UIDevice currentDevice] systemVersion] floatValue];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;        &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;if&lt;/span&gt; (version &amp;gt;= &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #800080; line-height: 1.5; "&gt;5.0&lt;/span&gt;) {&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillChangeFrameNotification &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;object&lt;/span&gt;:nil];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;        }&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;#endif&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.8em; direction: ltr; "&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;2）然后添加键盘事件的处理代码：&lt;/p&gt;&lt;p&gt;获取到当前keyboard的高度以及动画时间，然后对视图进行对应的操作即可。&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: #ffffff; font-size: 12px; color: #111111; line-height: 23px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;#pragma&lt;/span&gt; mark -&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;#pragma&lt;/span&gt; mark Responding to keyboard events&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;- (&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;void&lt;/span&gt;)keyboardWillShow:(NSNotification *)notification {&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;/*&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;     Reduce the size of the text view so that it's not obscured by the keyboard.&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;     Animate the resize so that it's in sync with the appearance of the keyboard.&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;     &lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;*/&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    NSDictionary *userInfo = [notification userInfo];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;//&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt; Get the origin of the keyboard when it's displayed.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/span&gt;    NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;//&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt; Get the top of the keyboard as the y coordinate of its origin in self's view's coordinate system. The bottom of the text view's frame should align with the top of the keyboard's final position.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/span&gt;    CGRect keyboardRect = [aValue CGRectValue];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;//&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt; Get the duration of the animation.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/span&gt;    NSValue *animationDurationValue = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    NSTimeInterval animationDuration;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    [animationDurationValue getValue:&amp;amp;animationDuration];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;//&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt; Animate the resize of the text view's frame in sync with the keyboard's appearance.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;/span&gt;    [self moveInputBarWithKeyboardHeight:keyboardRect.size.height withDuration:animationDuration];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;}&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;- (&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #0000ff; line-height: 1.5; "&gt;void&lt;/span&gt;)keyboardWillHide:(NSNotification *)notification {&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    NSDictionary* userInfo = [notification userInfo];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;/*&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;     Restore the size of the text view (fill self's view).&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;     Animate the resize so that it's in sync with the disappearance of the keyboard.&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;     &lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #008000; line-height: 1.5; "&gt;*/&lt;/span&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    NSValue *animationDurationValue = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    NSTimeInterval animationDuration;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    [animationDurationValue getValue:&amp;amp;animationDuration];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    &lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;    [self moveInputBarWithKeyboardHeight:&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #800080; line-height: 1.5; "&gt;0.0&lt;/span&gt; withDuration:animationDuration];&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;}&lt;/div&gt;&lt;p&gt;3）在视图控制器消除时，移除键盘事件的通知：&lt;/p&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: #ffffff; font-size: 12px; color: #111111; line-height: 23px; "&gt;[[NSNotificationCenter defaultCenter] removeObserver:self];&lt;/div&gt;&lt;p&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;ps:&lt;/p&gt;&lt;p&gt;ios5隐藏功能分享&amp;#8212;&amp;#8212;&amp;#8220;字典&amp;#8221;功能（英英字典）：&lt;/p&gt;&lt;p&gt;在任何输入框中选中一个英文单词，此时会有选择项&amp;#8220;复制&amp;#8221;，&amp;#8220;删除&amp;#8221;...等，还有一个向右的箭头，点击这个向右的箭头后，就会出现&amp;#8220;定义&amp;#8221;选项，点击这个&amp;#8220;定义&amp;#8221;按钮即会弹出这个英语单词的英文解释。&lt;/p&gt;&lt;div&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;- (void)textFieldDidBeginEditing&lt;/span&gt;&lt;img src="http://bbs.51cto.com/images/smilies/default/sad.gif" smilieid="2" border="0" alt="" style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-color: initial; border-width: initial; border-color: initial; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;UITextField *)textField&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;[self animateTextField: textField up: YES];&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp; - (void)textFieldDidEndEditing&lt;/span&gt;&lt;img src="http://bbs.51cto.com/images/smilies/default/sad.gif" smilieid="2" border="0" alt="" style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-color: initial; border-width: initial; border-color: initial; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;UITextField *)textField&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;[self animateTextField: textField up: NO];&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp; - (void) animateTextField: (UITextField*) textField up: (BOOL) up&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;const int movementDistance = 80; // tweak as needed&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;const float movementDuration = 0.3f; // tweak as needed&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;int movement = (up ? -movementDistance : movementDistance);&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;[UIView beginAnimations: @"anim" context: nil];&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;[UIView setAnimationBeginsFromCurrentState: YES];&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;[UIView setAnimationDuration: movementDuration];&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;self.view.frame = CGRectOffset(self.view.frame, 0, movement);&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;span style="font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; background-color: #ffffff; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;[UIView commitAnimations];&lt;/span&gt;&lt;br style="word-wrap: break-word; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; text-align: left; background-color: #ffffff; " /&gt;&lt;/div&gt;&lt;p&gt;&lt;span style="background-color: #ffffff; font-family: Helvetica, Arial, sans-serif; line-height: 22px; text-align: left; "&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2264652.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2011/11/26/2264652.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2011/11/17/2252160.html</id><title type="text">UILabel小结</title><summary type="text">一.默认状态单行,不可获取用户点击事件,UIViewContentModeRedraw模式,改变就重绘.二.相关属性与函数1.文本属性text // label 显示的文字font // text 的字体,值不可以是nil,否则异常textColor // text 的颜色textAlignment // text 的对其方式lineBreakMode// 当文字超出label显示区域时的截取方式typedefenum{ UILineBreakModeWordWrap =0, // 以空格为界,保留整个单词 UILineBreakModeCh...</summary><published>2011-11-17T01:38:00Z</published><updated>2011-11-17T01:38:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2011/11/17/2252160.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2011/11/17/2252160.html"/><content type="html">&lt;div&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: 14pt; "&gt;一.默认状态&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;单行,不可获取用户点击事件,UIViewContentModeRedraw模式,改变就重绘.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: 14pt; "&gt;二.相关属性与函数&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;1.文本属性&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;text// label 显示的文字&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;font// text 的字体,值不可以是nil,否则异常&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;textColor&amp;nbsp;  &amp;nbsp;// text 的颜色&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;textAlignment&amp;nbsp;&amp;nbsp;// text 的对其方式&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;lineBreakMode&amp;nbsp;&amp;nbsp;// 当文字超出label显示区域时的截取方式&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;typedef&amp;nbsp;enum&amp;nbsp;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; UILineBreakModeWordWrap =&amp;nbsp;0,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// 以空格为界,保留整个单词&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; UILineBreakModeCharacterWrap, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// 保留整个字符&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; UILineBreakModeClip,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// 画到边界为止&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; UILineBreakModeHeadTruncation,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// 省略开始,...代替&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; UILineBreakModeTailTruncation,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// 省略尾部,...代替&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; UILineBreakModeMiddleTruncation,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// 省略中间,...代替.这3个多行时作用于最后一行,多行时这三个以单词分行&lt;/p&gt;&lt;p&gt;} UILineBreakMode;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;enabled&lt;/span&gt;&amp;nbsp;// 文字是否可变,布尔值&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;2.文本区域&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;adjustsFontSizeToFitWidth&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;布尔值,@property(nonatomic) BOOL adjustsFontSizeToFitWidth,设置文本字体是否要减小来适应label的区域.只有当label的行数事1时有效.字体一直减小到你设置的最小字体值.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;baselineAdjustment&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;当adjustsFontSizeToFitWidth值为YES的时候,如果文本的font需要缩小,这个值控制基线位置.只有为本行数为1时有效&lt;/p&gt;&lt;p&gt;@property(nonatomic) UIBaselineAdjustment baselineAdjustment&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;typedef&amp;nbsp;enum&amp;nbsp;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;UIBaselineAdjustmentAlignBaselines =&amp;nbsp;0,&amp;nbsp;// 默认值文本最上端与label中间线对齐&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;UIBaselineAdjustmentAlignCenters,//&amp;nbsp;文本中间与label中间线对齐&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;UIBaselineAdjustmentNone,//&amp;nbsp;文本最底端与label中间线对齐&lt;/p&gt;&lt;p&gt;} UIBaselineAdjustment;&lt;/p&gt;&lt;div style="font-family: verdana, Arial, Helvetica; line-height: 25px; "&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;minimumFontSize&lt;/span&gt;&amp;nbsp;// 最小字体,行数为1时有效,默认0.0&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;numberOfLines&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;// 文本行数,为0时没有最大行数限制&lt;/p&gt;&lt;p&gt;&lt;strong&gt;3.高亮设置&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;highlightedTextColor&amp;nbsp;&lt;/span&gt;// 文本高亮时的颜色&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;highlighted　&lt;/span&gt;// 文本是否高亮&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;4.绘制阴影&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;shadowColor // 阴影颜色&lt;/p&gt;&lt;p&gt;shadowOffset// 阴影偏移&lt;/p&gt;&lt;p&gt;&lt;strong&gt;5.重载绘画&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&amp;#8211;&amp;nbsp;&lt;span style="background-color: #ffff00; "&gt;textRectForBounds:limitedToNumberOfLines: // 不可直接调用,需要子类重载,第二参数为0时没有行数限制&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;#8211;&amp;nbsp;&lt;span style="background-color: #ffff00; "&gt;drawTextInRect:&amp;nbsp;&amp;nbsp;&lt;/span&gt;// 不可直接调用,需要子类重载&lt;/p&gt;&lt;p&gt;&lt;strong&gt;6.用户交互&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #ffff00; "&gt;userInteractionEnabled&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// 是否可与用户交互,基本上也都在子类中重载使用&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;三.常用范例&lt;/p&gt;&lt;p&gt;1.取得label大小正好适合文字&lt;/p&gt;&lt;div&gt;NSString* text = &lt;span style="color: #800000; "&gt;@"&lt;/span&gt;&lt;span style="color: #800000; "&gt;this is a simple uilabel sample&lt;/span&gt;&lt;span style="color: #800000; "&gt;"&lt;/span&gt;;&lt;br style="line-height: 10px; " /&gt;UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero];&lt;br style="line-height: 10px; " /&gt;label.backgroundColor = [UIColor redColor];&lt;br style="line-height: 10px; " /&gt;CGFloat width = &lt;span style="color: #800080; "&gt;30.0&lt;/span&gt;;&lt;br style="line-height: 10px; " /&gt;UIFont*  font = [UIFont systemFontOfSize:&lt;span style="color: #800080; "&gt;14.0&lt;/span&gt;];&lt;br style="line-height: 10px; " /&gt;label.font = font;&lt;br style="line-height: 10px; " /&gt;label.numberOfLines = &lt;span style="color: #800080; "&gt;0&lt;/span&gt;;&lt;br style="line-height: 10px; " /&gt;label.lineBreakMode = UILineBreakModeWordWrap;&lt;br style="line-height: 10px; " /&gt;label.text = text;&lt;br style="line-height: 10px; " /&gt;&lt;span style="color: #008000; "&gt;//&lt;/span&gt;&lt;span style="color: #008000; "&gt; 方法一,用文字来确定&lt;/span&gt;&lt;span style="color: #008000; "&gt;&lt;br style="line-height: 10px; " /&gt;&lt;/span&gt;CGSize size = [text sizeWithFont:font constrainedToSize:CGSizeMake(width, &lt;span style="color: #800080; "&gt;2000.0&lt;/span&gt;) lineBreakMode:UILineBreakModeWordWrap];&lt;br style="line-height: 10px; " /&gt;&lt;span style="color: #008000; "&gt;//&lt;/span&gt;&lt;span style="color: #008000; "&gt; 方法二,自适应&lt;br style="line-height: 10px; " /&gt;&lt;/span&gt;&lt;span style="color: #008000; "&gt;//&lt;/span&gt;&lt;span style="color: #008000; "&gt;CGSize size = [label sizeThatFits:CGSizeMake(width, 2000.0)];&lt;/span&gt;&lt;span style="color: #008000; "&gt;&lt;br style="line-height: 10px; " /&gt;&lt;/span&gt;    &lt;br style="line-height: 10px; " /&gt;label.frame = CGRectMake(&lt;span style="color: #800080; "&gt;0&lt;/span&gt;, &lt;span style="color: #800080; "&gt;0&lt;/span&gt;, size.width, size.height);&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2252160.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2011/11/17/2252160.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/jacktu/archive/2011/11/13/2247255.html</id><title type="text">【转】iPhone 模态对话框 立即返回结果</title><summary type="text">原文：http://blog.csdn.net/xianpengliu/article/details/6591624iPhone中的UIAlertView用于显示一个模态对话框显示时设置代理delegate，当用户点击对话框中按钮时，系统将会调用delegate的函数从而使得程序可以根据用户的选择进行相应的处理这里使用了代理模式，虽然代理模式在ios的设计中有很多优雅的地方但是这里，用在返回模态对话框的结果，未免有点儿不合时宜每次用到这个，我就非常怀念MFC中的模态对话框：view plainReturnValueret=dlg.doModal();if(ret==x){...}else{.</summary><published>2011-11-13T06:45:00Z</published><updated>2011-11-13T06:45:00Z</updated><author><name>jsot</name><uri>http://www.cnblogs.com/jacktu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/jacktu/archive/2011/11/13/2247255.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/jacktu/archive/2011/11/13/2247255.html"/><content type="html">&lt;div&gt;&lt;p&gt;原文：http://blog.csdn.net/xianpengliu/article/details/6591624&amp;nbsp;&lt;/p&gt;&lt;p&gt;iPhone中的UIAlertView用于显示一个模态对话框&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;显示时设置代理delegate，当用户点击对话框中按钮时，系统将会调用delegate的函数&lt;/p&gt;&lt;p&gt;从而使得程序可以根据用户的选择进行相应的处理&lt;/p&gt;&lt;p&gt;这里使用了代理模式，虽然代理模式在ios的设计中有很多优雅的地方&lt;/p&gt;&lt;p&gt;但是这里，用在返回模态对话框的结果，未免有点儿不合时宜&lt;/p&gt;&lt;p&gt;每次用到这个，我就非常怀念MFC中的模态对话框：&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div bg_cpp"="" style="padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; background-color: #ffffff; width: 834px; line-height: 26px; text-align: left; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-style: initial; border-color: initial; border-image: initial; "&gt;&lt;a href="http://blog.csdn.net/xianpengliu/article/details/6591624#" title="view plain" style="padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; border-style: initial; border-color: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; "&gt;view plain&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ol start="1" style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;ReturnValue&amp;nbsp;ret&amp;nbsp;=&amp;nbsp;dlg.doModal();&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;if&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;(ret&amp;nbsp;==&amp;nbsp;x)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;}&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;else&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; " /&gt;&lt;p&gt;下面，封装一个类来实现这种简介的操作（代码摘自《iPhone开发秘籍》）：&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div bg_cpp"="" style="padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; width: 834px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-style: initial; border-color: initial; border-image: initial; "&gt;&lt;a href="http://blog.csdn.net/xianpengliu/article/details/6591624#" title="view plain" style="padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; border-style: initial; border-color: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; "&gt;view plain&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ol start="1" style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;#import&amp;nbsp;&amp;lt;UIKit/UIKit.h&amp;gt;&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@interface&amp;nbsp;ModalAlert&amp;nbsp;:&amp;nbsp;NSObject&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;+&amp;nbsp;(&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; "&gt;BOOL&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;)&amp;nbsp;ask:&amp;nbsp;(NSString&amp;nbsp;*)&amp;nbsp;question;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;+&amp;nbsp;(&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; "&gt;BOOL&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;)&amp;nbsp;confirm:(NSString&amp;nbsp;*)&amp;nbsp;statement;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@end&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div bg_cpp"="" style="padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; width: 834px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-style: initial; border-color: initial; border-image: initial; "&gt;&lt;a href="http://blog.csdn.net/xianpengliu/article/details/6591624#" title="view plain" style="padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; border-style: initial; border-color: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; "&gt;view plain&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ol start="1" style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;#import&amp;nbsp;"ModalAlert.h"&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@interface&amp;nbsp;ModalAlertDelegate&amp;nbsp;:&amp;nbsp;NSObject&amp;nbsp;&amp;lt;UIAlertViewDelegate&amp;gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CFRunLoopRef&amp;nbsp;currentLoop;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NSUInteger&amp;nbsp;index;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@property&amp;nbsp;(readonly)&amp;nbsp;NSUInteger&amp;nbsp;index;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@end&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@implementation&amp;nbsp;ModalAlertDelegate&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@synthesize&amp;nbsp;index;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;//&amp;nbsp;Initialize&amp;nbsp;with&amp;nbsp;the&amp;nbsp;supplied&amp;nbsp;run&amp;nbsp;loop&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;-(id)&amp;nbsp;initWithRunLoop:&amp;nbsp;(CFRunLoopRef)runLoop&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;if&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;(self&amp;nbsp;=&amp;nbsp;[super&amp;nbsp;init])&amp;nbsp;currentLoop&amp;nbsp;=&amp;nbsp;runLoop;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;return&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;self;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;//&amp;nbsp;User&amp;nbsp;pressed&amp;nbsp;button.&amp;nbsp;Retrieve&amp;nbsp;results&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;-(&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;void&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;)&amp;nbsp;alertView:&amp;nbsp;(UIAlertView*)aView&amp;nbsp;clickedButtonAtIndex:&amp;nbsp;(NSInteger)anIndex&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index&amp;nbsp;=&amp;nbsp;anIndex;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CFRunLoopStop(currentLoop);&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@end&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@implementation&amp;nbsp;ModalAlert&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;+(NSUInteger)&amp;nbsp;queryWith:&amp;nbsp;(NSString&amp;nbsp;*)question&amp;nbsp;button1:&amp;nbsp;(NSString&amp;nbsp;*)button1&amp;nbsp;button2:&amp;nbsp;(NSString&amp;nbsp;*)button2&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CFRunLoopRef&amp;nbsp;currentLoop&amp;nbsp;=&amp;nbsp;CFRunLoopGetCurrent();&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;//&amp;nbsp;Create&amp;nbsp;Alert&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ModalAlertDelegate&amp;nbsp;*madelegate&amp;nbsp;=&amp;nbsp;[[ModalAlertDelegate&amp;nbsp;alloc]&amp;nbsp;initWithRunLoop:currentLoop];&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UIAlertView&amp;nbsp;*alertView&amp;nbsp;=&amp;nbsp;[[UIAlertView&amp;nbsp;alloc]&amp;nbsp;initWithTitle:question&amp;nbsp;message:nil&amp;nbsp;delegate:madelegate&amp;nbsp;cancelButtonTitle:button1&amp;nbsp;otherButtonTitles:button2,&amp;nbsp;nil];&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[alertView&amp;nbsp;show];&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;//&amp;nbsp;Wait&amp;nbsp;for&amp;nbsp;response&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CFRunLoopRun();&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;//&amp;nbsp;Retrieve&amp;nbsp;answer&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NSUInteger&amp;nbsp;answer&amp;nbsp;=&amp;nbsp;madelegate.index;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[alertView&amp;nbsp;release];&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[madelegate&amp;nbsp;release];&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;return&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;answer;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;+&amp;nbsp;(&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; "&gt;BOOL&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;)&amp;nbsp;ask:&amp;nbsp;(NSString&amp;nbsp;*)&amp;nbsp;question&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;return&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;[ModalAlert&amp;nbsp;queryWith:question&amp;nbsp;button1:&amp;nbsp;@&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;"No"&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;button2:&amp;nbsp;@&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;"Yes"&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;];&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;+&amp;nbsp;(&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; "&gt;BOOL&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;)&amp;nbsp;confirm:&amp;nbsp;(NSString&amp;nbsp;*)&amp;nbsp;statement&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;return&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;&amp;nbsp;[ModalAlert&amp;nbsp;queryWith:statement&amp;nbsp;button1:&amp;nbsp;@&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;"Cancel"&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&amp;nbsp;button2:&amp;nbsp;@&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;"OK"&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;];&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;@end&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;这样，就可以使用一行代码显示模态对话框并获得返回值了：&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div bg_cpp"="" style="padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; width: 834px; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; "&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-style: initial; border-color: initial; border-image: initial; "&gt;&lt;a href="http://blog.csdn.net/xianpengliu/article/details/6591624#" title="view plain" style="padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; border-style: initial; border-color: initial; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; "&gt;view plain&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ol start="1" style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;li style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; line-height: 18px; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;NSUInteger&amp;nbsp;answer&amp;nbsp;=&amp;nbsp;[ModalAlert&amp;nbsp;ask:@&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;"Are&amp;nbsp;you&amp;nbsp;sure?"&lt;/span&gt;&lt;span style="border-style: initial; border-color: initial; border-width: initial; border-color: initial; "&gt;]; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/jacktu/aggbug/2247255.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/jacktu/archive/2011/11/13/2247255.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry></feed>
