Reputation: 1759
I am new to ios, I am reading ios sample code "StreetScroller" In file: InfiniteScrollView.h:, it declare interface InfiniteScrollView But in file, InfiniteScrollView.m, it decare the interface again and add two other variables. It seems duplicate. Can anyone give an explanation about this, and tell me some url address about Object C.
Thanks advances.
Upvotes: 0
Views: 88
Reputation: 299355
You're probably seeing this:
@interface InfiniteScrollView ()
...
@end
This is called a class extension and is denoted by the ()
. As the name suggests, it allows you to extend the class. This is commonly used in ObjC to declare private methods and properties.
There is a similar technique called a category that looks like this:
@interface InfiniteScrollView (CategoryName)
...
@end
There are slight differences between the two. Both are explained in the docs linked above.
Upvotes: 2