排序的控制是一个UITableViewCellReorderControl,但它是一个私有的类,不能直接访问它,通过子视图的层次结构找到它的图片。在自定义cell里添加如下方法:
- (void) setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing: editing animated: YES];
if (editing) {
for (UIView * view in self.subviews) {
if ([NSStringFromClass([view class]) rangeOfString: @"Reorder"].location != NSNotFound) {
for (UIView * subview in view.subviews) {
if ([subview isKindOfClass: [UIImageView class]]) {
((UIImageView *)subview).image = [UIImage imageNamed: @"new.png"];
}
}
}
}
}
}
本文介绍了如何在iOS中修改UITableView的默认排序图标。由于UITableViewCellReorderControl是私有类,无法直接操作,因此需要通过查找子视图来更换图片。在自定义cell内实现了相关方法来实现这一功能。
6757

被折叠的 条评论
为什么被折叠?



