2010-04-18 75 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得到了圖像,切去底部填充和作出的背景在我的圖形程序透明。它在選擇行時具有完整的存取器功能,但是圖像在選擇時不是藍色的,這實際上很煩人(它似乎完全忽略了背景透明度)。

相關問題