旋转UITableViewCell细节披露指标不工作

问题描述:

我想使用以下代码在静态UITableView中将详细披露指标旋转90度,但它不起作用。旋转UITableViewCell细节披露指标不工作

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); 

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

请注意:我不是在谈论详细披露按钮,我正在谈论关于详细披露指标。 此外,我想避免使用它的自定义图像,只是想使用内置的一个。

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

如果您想要一个指向不同方向的配件箭头,您必须自己在accessoryView中创建它。

最大

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

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

不起作用旋转的ImageView的。不要试试这个解决方案的人 – 2017-05-03 11:16:02