I'm making a UITableView
with expandable/collapsable cells for ios app. I put a UITableViewCellAccessoryDisclosureIndicator
on these cells but I'd like to make the arrow headed up/down when the cell is expanded/collapsed.
I found that it's possible to make a button with a custom image and change the button according to the state of the cell but it seems dirty to me because I don't need a button there and I have to add 2 images to the project (ok it's not that big but anyway).
So shouldn't it be better to simply rotate the existing UITableViewCellAccessoryDisclosureIndicator
? and if so how can I do that?
This is not exactly what you want, but this the first thing I thought of. First, instantiate a button of type UIButtonTypeDetailDisclosure:
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
Next, rotate the button 90 degrees:
CGAffineTransform rotationTransform = CGAffineTransformIdentity;
rotationTransform = CGAffineTransformRotate(rotationTransform, DegreesToRadians(90));
button.transform = rotationTransform;
Finally, use the button as the accessoryView:
cell.accessoryView = button;
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With