0

I am trying to rotate the detail disclosure indicator by 90 degrees in a static UITableView using the following code, but it is not working.

NSIndexPath* cellIndext = [NSIndexPath indexPathForRow:1 inSection:0];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:cellIndext];
cell.accessoryView.transform = CGAffineTransformMakeRotation(90.0*M_PI/180.0);

also tried:

cell.accessoryView.transform = CGAffineTransformRotate(cell.accessoryView.transform,    90*M_PI/180);

still did not work, any help is appreciated.

Please note: I am not talking about the detail disclosure button I am talking bout the detail disclosure indicator. Also, I want to avoid using a custom image for it, just want to use the built in one.

Naz
  • 215
  • 3
  • 12

2 Answers2

2

Apple's built in accessoryType does not utilize the .accessoryView property. Apple uses an internal view to display the built-in accessories. Therefore, you cannot modify them.

If you want an accessory arrow that points in a different direction, you will have to create it yourself inside of the accessoryView.

Max

mxweas
  • 244
  • 1
  • 3
0

1)You can rotate the button of accessoryView

UIButton *accessoryBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[accessoryBtn setImage:[UIImage imageNamed:@"image.png"] forState:UIControlStateNormal];
[accessoryBtn setFrame:CGRectMake(0, 0, 28, 28)];
selectedCell.accessoryView = accessoryBtn ;

CGAffineTransform t = CGAffineTransformIdentity;
t = CGAffineTransformRotate(t, DegreesToRadians(90));
accessoryBtn.transform = t;

2)You can rotate an imageView at that location

UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,28,28)];
iv.image = [UIImage imageNamed:@"image.png"];
iv.transform = CGAffineTransformMakeRotation(M_PI/2);
Subbu
  • 2,063
  • 4
  • 29
  • 42