UITableVIew拖动排序时调整阴影

326 阅读1分钟

创建UITableView子类,重写layoutSubviews:方法

- (void)layoutSubviews {

[super layoutSubviews];

[[self.subviews filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) {

if ([NSStringFromClass([evaluatedObject class]) rangeOfString: @"ShadowView"].location != NSNotFound) {

return YES;

}

return NO;

}]] enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {

obj.alpha = 0.2;

}];

}