我試圖給tableviewcell
的不同backgroundColor
s與colorwithPatternImage
並且它不按預期方式工作。該文件沒有提到一次只能使用一種模式。UIColor colorWithPatternImage只使用一個圖像
說我有3行,我設置背景像這樣:
Cell1.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"red.png"]];
Cell2.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"green.png"]];
Cell3.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"blue.png"]];
所有3行會是紅色的。就好像有一些全球顏色正在返回。
colorWithPatternImage
返回kCGColorSpaceModelPattern 1
對於每次調用,無論傳入什麼圖像。如果確實一次只有一個全局模式,那麼顏色應該是最後一個設置,換句話說是藍色。
這沒有任何意義。有沒有人有任何內部專業知識蘋果在這裏做什麼?
編輯 我甚至在完全獨立的視圖中使用不同的模式,它仍然會影響其他視圖的模式。我相信,儘管文檔沒有說明這一點,但您一次只能使用一種UIColor圖像模式。傷心。
感謝您的更新:) – Brenden 2011-12-21 03:38:52