2010-04-18 77 views

回答

7

我发现你可以继承UITableViewCell,覆盖layoutSubviews,并在该方法中,获取accessoryView并根据需要调整其框架。

+0

不错!看起来像是一个好主意,把它作为UITableViewCell上的一个类别,并从你的所有UITableViewCell子类中调用它。 – 2011-04-02 03:32:10

1

在我的应用程序,我发现下面的代码部分工作的解决方案:

UIImage *accessoryImage = [UIImage imageNamed:@"accessory_disclosure_bottom.png"]; 
UIImageView *accImageView = [[UIImageView alloc] initWithImage:accessoryImage]; 
[accImageView setFrame:CGRectMake(0, 10, 14, 28)]; 
accImageView.backgroundColor = [UIColor greenColor]; 
accImageView.userInteractionEnabled = YES; 
cell.accessoryView = accImageView; 

我从http://m.tech-recipes.com/rx/UITV_accessory_disclosure.png得到了图像,切去底部填充和作出的背景在我的图形程序透明。它在选择行时具有完整的存取器功能,但是图像在选择时不是蓝色的,这实际上很烦人(它似乎完全忽略了背景透明度)。

相关问题