0

我正在尝试使用以下代码在静态 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);

仍然没有工作,任何帮助表示赞赏。

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

4

2 回答 2

2

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

如果你想要一个指向不同方向的附件箭头,你必须在附件视图中自己创建它。

最大限度

于 2013-05-11T05:17:32.843 回答
0

1)您可以旋转附件视图的按钮

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)您可以在该位置旋转图像视图

UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,28,28)];
iv.image = [UIImage imageNamed:@"image.png"];
iv.transform = CGAffineTransformMakeRotation(M_PI/2);
于 2013-05-11T05:32:22.727 回答