旋转UITableViewCell详细信息披露指标不起作用

时间:2013-05-11 03:36:44

标签: ios uitableview

我正在尝试使用以下代码在静态UITableView中将细节披露指示器旋转90度,但它无法正常工作。

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

也尝试过:

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

仍然没有用,感谢任何帮助。

请注意:我不是在谈论细节披露按钮我正在谈论细节披露指标。 另外,我想避免使用自定义图像,只想使用内置图像。

2 个答案:

答案 0 :(得分:1)

Apple内置的accessoryType不使用.accessoryView属性。 Apple使用内部视图显示内置附件。因此,您无法修改它们。

如果你想要一个指向不同方向的辅助箭头,你必须自己在accessoryView内创建它。

最高

答案 1 :(得分:0)

1)您可以旋转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)您可以在该位置旋转imageView

UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,28,28)];
iv.image = [UIImage imageNamed:@"image.png"];
iv.transform = CGAffineTransformMakeRotation(M_PI/2);
相关问题