摇曳的中指|赵剑飞

迸发出二的火花

Skip to: Content | Sidebar | Footer

Category: Objective-C

@selector in Objective-c

20 七月, 2011 (22:28) | IOS, Objective-C | By: 摇曳的中指

SEL is a type that represents a selector in Objective-C. The @selector() keyword returns a SEL that you describe. It’s not a function pointer and you can’t pass it any objects or references of any kind. For each variable in the selector (method), you have to represent that in the call to @selector. For example:

矩形重叠问题,碰撞算法,Objective-C实现

7 一月, 2011 (22:55) | IOS, Objective-C | By: 摇曳的中指

这个实际上是《Objective-C 2.0 程序设计》第八章 练习题第6题,觉得挺有意思,就分享一下。还没看答案,这个是我能想到的最优算法了,一会儿去看看答案如何。

已知矩形Rectangle类继承自GraphicObject类(这个类 和本次的操作没有任何关系); 座标 XYPoint类,代码如下:

Rectangle类,Rectangle声明一个intersect方法,该方法传入一个矩形作为参数, 返回一个重叠的Recangle类型的对象,Rectangle类有座标origin作为属性,origin是XYPoint类型。[还有更多......]



dnf dnf DNF DNF DNF DNF˫ DNF˫ DNF˫ DNFô˫ DNF˫ٱ dnf dnf DNF DNF DNF dnf2020 dnf2020.com DNF www.dnf2020.com 2020DNF