为什么仅靠引用UIKit.h就可以调用NSIndexPath?

清醒疯子 发布于 2014年02月24日
无人欣赏。

初步的答案是:

因为UIKit.h里引用了UITableView.h,而UITableView.h里有一个NSIndexPath的Category声明:

@interface NSIndexPath (UITableView)
+ (NSIndexPath *)indexPathForRow:(NSInteger)row inSection:(NSInteger)section;
@property(nonatomic,readonly) NSInteger section;
@property(nonatomic,readonly) NSInteger row;
@end

但为什么要这样搞咧?

共2条回复
yangjie6020 回复于 2014年02月24日

没看明白啊 老兄 写详细点

xamppobjc 回复于 2014年02月24日

NSIndexPath.h类在Foundation.framework里面声明的。

@interface NSIndexPath : NSObject <NSCopying, NSCoding> {

登录 或者 注册
相关帖子