共 13 篇文章
显示摘要每页显示  条
anonymous object (匿名对象) 未知类的一个对象。A memory-management technique in which each entity that claims ownership of an object increments the object’s reference count and later decrements it. When the object’s reference count reaches zero, the object is deallocated. This technique allows one instance of an ob...
Objective-C 编程语言官网文档(十二)-线程声明:本文档仅为个人学习过程中顺手翻译之作,方便开发的同胞借鉴参考。@synchronized() 指令只有一个参数,可以是任何 Objective-C 对象, 包括 self. 这个对象被称为互斥信号量. 它允许一个线程锁定一个代码块以防止同一时间被其它线程访问。To protect sections of code from being executed by mo...
可以使用 @throw 指令来抛出一个异常,本质上来说这是一个 Objective-C 对象. 通常你会用到一个 NSException 对象,但不是必须的。@catch (NSException *exception) {没人限制你必须抛出 NSException 对象. 你可以抛出任何 Objective-C 的对象来作为异常对象. NSException 类提供了可以在异常处理提供帮助的方法,但如果愿意你可以实现你自己...
The runtime system makes sure each identifier is unique: No two selectors are the same, and all methods with the same name have the same selector.The display method for one class, for example, has the same selector as display methods defined in other classes.The messaging routine has access to method implementations o...
Static typing also doesn’t affect how the object is treated at runtime. Statically typed objects are dynamically allocated by the same class methods that create instances of type id. If Square is a subclass of Rectangle, the following code would still produce an object with all the instance variables of a Square obje...
NSArray *array = <#Get an array#>;The following code example illustrates using fast enumeration with NSArray and NSDictionary objects.For collections or enumerators that have a well-defined order—such as an NSArray or an NSEnumerator instance derived from an array—the enumeration proceeds in that order, so sim...
(NSString *)objc_getAssociatedObject(array, &overviewKey);objc_setAssociatedObject(array, &overviewKey, nil, OBJC_ASSOCIATION_ASSIGN);You use the Objective-C runtime function objc_setAssociatedObject to make an association between one object and another.At point 1, the string overview is still valid because th...
The declaration of a category interface looks very much like a class interface declaration—except the category name is listed within parentheses after the class name and the superclass isn’t mentioned. Unless its methods don’t access any instance variables of the class, the category must import the interface file f...
属性(Property)声明中的额外属性(Attribute)Property跟Attribute都可翻译为属性,但两者在这里是不同的,Property只类范围的属性,而Attributes是额外属性,作用域比Property小。Important If you do not specify either @synthesize or @dynamic for a particular property, you must provide a getter and setter (or just a getter in the...
Declaring a Protocol.They both declare methods, and at runtime they’re both represented by objects—classes by instances of Class and protocols by instances of Protocol. Like class objects, protocol objects are created automatically from the definitions and declarations found in source code and are used by the runtim...
帮助 | 留言交流 | 联系我们 | 服务条款 | 下载网文摘手 | 下载手机客户端
北京六智信息技术股份有限公司 Copyright© 2005-2024 360doc.com , All Rights Reserved
京ICP证090625号 京ICP备05038915号 京网文[2016]6433-853号 京公网安备11010502030377号
返回
顶部