My app subclasses UICollectionViewFlowLayout
and uses all of its properties except for minimumLineSpacing
. To avoid confusion, I'd like to be able to "hide" minimumLineSpacing
from the outside, so it looks like my subclass doesn't even support it. Is this possible?
问问题
1003 次
2 回答
13
Yes you can. Kind of. You can mark it with __attribute__((unavailable))
, which will cause the compiler to throw an error if you use it. However, the property will still be accessible if your object is cast to its superclass type, as this is a compile-time-only thing.
@interface MyClass : UICollectionViewFlowLayout
@property (nonatomic) CGFloat minimumLineSpacing __attribute__((unavailable));
@end
于 2013-03-30T00:45:01.353 回答
1
I don't think you can actually hide it. You could of course overwrite the getter and setter and prevent the acutal value from beeing changed, if that is of importance. But they will always exist and be visible.
于 2013-03-30T00:42:51.150 回答