我正在使用ios app的可扩展/可折叠单元格UITableView
。我在这些细胞上放了一个UITableViewCellAccessoryDisclosureIndicator
,但是当细胞扩张/折叠时,我想让箭头向上/向下移动。
我发现可以制作一个带有自定义图像的按钮,并根据单元格的状态更改按钮,但它看起来很脏,因为我不需要那里的按钮,我必须添加2个图像到这个项目(好吧,不管怎么说,不管怎么说)。
简单地旋转现有的UITableViewCellAccessoryDisclosureIndicator
不应该更好吗?如果是这样我怎么能这样做?
答案 0 :(得分:8)
这不是你想要的,但这是我想到的第一件事。首先,实例化UIButtonTypeDetailDisclosure类型的按钮:
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
接下来,将按钮旋转90度:
CGAffineTransform rotationTransform = CGAffineTransformIdentity;
rotationTransform = CGAffineTransformRotate(rotationTransform, DegreesToRadians(90));
button.transform = rotationTransform;
最后,使用按钮作为accessoryView:
cell.accessoryView = button;
希望有所帮助。