如何旋转UITableViewCellAccessoryDisclosureIndicator?
我正在做一个UITableView
与可扩展/可折叠单元格的iOS应用程序。 我在这些单元格上放置了一个UITableViewCellAccessoryDisclosureIndicator
,但是当单元格展开/折叠时,我想使箭头朝上/朝下。
我发现有可能做一个自定义图像的button,并根据单元格的状态更改button,但它对我来说似乎很脏,因为我不需要一个button,我必须添加2个图像的项目好吧,这不是那么大,但无论如何)。
所以不应该简单地旋转现有的UITableViewCellAccessoryDisclosureIndicator
? 如果是的话,我该怎么做?
这不是你想要的,但这是我想到的第一件事。 首先,实例化一个types为UIButtonTypeDetailDisclosure的button:
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
接下来,旋转button90度:
CGAffineTransform rotationTransform = CGAffineTransformIdentity; rotationTransform = CGAffineTransformRotate(rotationTransform, DegreesToRadians(90)); button.transform = rotationTransform;
最后,使用button作为附件:
cell.accessoryView = button;
希望有所帮助。