我正在研究“元素”示例应用程序的源代码,我在
AtomicElement.h
@property (readonly) UIImage *stateImageForAtomicElementTileView;
@property (readonly) UIImage *flipperImageForAtomicElementNavigationItem;
@property (readonly) UIImage *stateImageForAtomicElementView;
@property (readonly) CGPoint positionForElement;
在实现文件中,它们看起来像
- (UIImage *)stateImageForAtomicElementTileView {
return [UIImage imageNamed:[NSString stringWithFormat:@"%@_37.png",state]];
}
你能详细说明一下这样做的原因吗?为什么不使用
- (UIImage*) stateImageForAtomicElementTileView;
在头文件中,然后像
[element stateImageForAtomicElementTileView];
element.stateImageForAtomicElementTileView
?