2013年2月21日

volatile

摘要: 来源: Java 语言中的 volatile 变量可以被看作是一种 “程度较轻的 synchronized”;与 synchronized 块相比,volatile 变量所需的编码较少,并且运行时开销也较少,但是它所能实现的功能也仅是 synchronized 的一部分。本文介绍了几种有效使用 vo... 阅读全文

posted @ 2013-02-21 22:25 wacao 阅读(312) 评论(0) 推荐(0) 编辑

iOS分类和扩展(Categories和Extensions)

摘要: 分类(Category)分类能够做到的事情主要是:即使在你不知道一个类的源码情况下,向这个类添加扩展的方法。此外,分类能够保证你的实现类和其他的文件区分开。View Code 1 #import “UIViewController.h”2 @interface UIViewController(CustomView)3 -(void)extMethod;4 @end使用分类为类添加方法(Add Methods to Classes)通过在interface中声明一个额外的方法并且在implementation 中定义相同名字的方法即可。分类的名字(也就是括号括起来的CustomView)表示的 阅读全文

posted @ 2013-02-21 15:57 wacao 阅读(7539) 评论(3) 推荐(2) 编辑

Property Declaration Attributes

摘要: 题目不知道应该怎么翻译?硬是要翻译,只能是属性声明的特性。对于这部分内容,《The Object C 2.0 Programming Language》的介绍是:You can decorate a property with attributes by using the form @property(attribute[,attribute2,...]). Like methods,properties are scoped to their enclosing interface declaration.For propertydeclarations that use a comma 阅读全文

posted @ 2013-02-21 15:53 wacao 阅读(241) 评论(0) 推荐(0) 编辑

导航