NSF*_*NSF 9 cocoa-touch uitableview uistoryboard ios7
我在iOS7上,并为我的UITableView带有静态单元格的UITableViewCell子类.我在实现中重写了setSelected方法.
由于某种原因,该方法仅在表加载时被调用,但在实际抽取和选择单元格时不会被调用.
我在这做错了什么?我如何让它工作?
@implementation StudentMenuMultipleOptionsTableViewCell
- (void)setSelected:(BOOL)selected {
[super setSelected:selected];
if (selected) {
UIView *view = [UIView new];
view.backgroundColor = [UIColor colorWithRed:0.542 green:0.788 blue:0.060 alpha:1.000];
self.selectedBackgroundView = view;
}
else {
for (UIView *view in self.subviews) {
if ([view isKindOfClass:[BlackBackgroundSelectedButton class]]) {
BlackBackgroundSelectedButton *button = (BlackBackgroundSelectedButton *)view;
button.selected = NO;
[button setWhite];
}
}
}
}
@end
Run Code Online (Sandbox Code Playgroud)
NSF*_*NSF 39
问题是我使用的是setSelected方法.需要用于较新iOS版本的方法是:
- (void)setSelected:(BOOL)selected animated:(BOOL)animated;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5712 次 |
最近记录: |