0
我試着將它設置爲背景的UICell之前設置的圖像色調的顏色,但它只是根據我的UIColor返回純色setTint上UICell返回純色
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
UIImage *testImage = [UIImage imageNamed:@"ImageName.png"];
testImage = [testImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImageView *testView = [[UIImageView alloc] initWithImage:testImage];
[testView setTintColor:[UIColor greenColor]];
cell.backgroundView = testView;
}
我明白了。我不明白的是,我所看到的關於此事的所有資料都表明,要改變圖像的色調,上面的代碼就足夠了。那麼我怎麼去着色一個圖像呢? – justMike
根據這篇文章應該是可行的? http://stackoverflow.com/questions/1223340/iphone-how-do-you-color-an-image/4630136#4630136 – justMike
我實現了這個類別,我用同一個純色http:// stackoverflow.com/questions/1223340/iphone-how-do-you-color-an-image/27356928#27356928 – justMike