以下代码在 IOS 5.0、6.0、6.1 等版本上返回“YES”,但在 IOS 7.0 上返回“NO”。您有什么想法吗?这是 IOS 7.0 的一个 bug 吗? 谢谢。
我重写了
[view isKindOfClass:[SimpleLabel class]]
PS:“SimpleLabel”是从UILabel继承的一个类。
----更新----
抱歉问题不够清晰。 :( 我在UITableViewCell
类中使用上述代码,并添加如下SimpleLabel
;
[self addSubview:label];
我重写了
layoutSubviews
函数,循环遍历self.subviews
,但是[view class]
总是返回UITableViewCellScrollView
。-(void)layoutSubviews {
[super layoutSubviews];
for (UIView*view in self.subviews) {
if ([view isKindOfClass:[SimpleLabel class]]) {
SimpleLabel*label = (SimpleLabel*)view;