Objective-C
blessdyb
这个作者很懒,什么都没留下…
展开
-
Objective-C中NSValue的使用
我们在C/C++开发中常会用到结构体来帮助我们简单封装基本数据类型,在Objective-C中我们也可以使用结构体来完成数据类型的封装。同时,Cocoa Touch还提供了一个NSValue来帮助我们更好地在开发中使用结构体。 我们可以使用NSValue来辅助我们实现一些简单数据结构的封装。比如我们定义了一个简单的结构体类型 typedef s...2010-05-15 17:08:03 · 126 阅读 · 0 评论 -
Objective-C中Collections等类的深复制
所有的开发语言中都会遇到对象的复制问题,通常复制分为浅复制与深复制两种。以Objective-C中的Collections为例,在我们复制一个Collections的具体对象时,比如一个NSArray的对象,我们使用-copy,这样的结果是一个浅层次的复制,在我们对于原对象进行了改动后,所有使用-copy得到的对象都会被改动,这是由于源对象与当前对象是共享一个对象值的。 ...2010-05-15 17:31:55 · 97 阅读 · 0 评论 -
Notice when we improt files in Objective-C
Notice that for importing class header files that are not frameworks, the header file name is in quotes rather than the angle brackets used for importing frameworks (as was done in the header f...原创 2010-12-20 19:38:42 · 94 阅读 · 0 评论 -
What's the deference between @class and #import in Objective-C
The @class directive minimizes the amount of code seen by the compiler and linker, and is therefore the simplest way to give a forward declaration of a class name. Being simple, it avoids potentia...原创 2010-12-20 20:12:41 · 116 阅读 · 0 评论 -
The secret about Objective-C magic Data-Type id
The id data type is, in a sense, a generic data type. It can stand in for Objective-C basic data types (e.g., various types of numbers) or Cocoa Touch objects (e.g., buttons, arrays, and views). In fa...原创 2010-12-25 23:43:25 · 75 阅读 · 0 评论 -
Get random number in Objective-C by the function arc4random()
The C language offers a few choices for random number generation. I chose the arc4random() function. This more modern variant of the traditional rand() function is automatically seeded so that it doe...原创 2010-12-26 14:04:28 · 218 阅读 · 0 评论 -
Dot-notation in Objective-C's property with struct
Objective-C uses dot-notation for properties, and C uses dot-notation for structs; these can be chained. So, for example, UIView's frame is a property whose value is a struct( a CGRect); thus, you can...原创 2011-07-31 14:22:31 · 66 阅读 · 0 评论 -
How iOS application start?
Note for iOS learning.原创 2011-08-01 22:26:14 · 63 阅读 · 0 评论 -
A little difference between objective-C and Java or C#
When I start to write Apps for iOS, I found a little different difference between Objective-C and Other OO language. e.g. -(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UI...原创 2011-11-19 10:56:09 · 78 阅读 · 0 评论