2012-09-17 21 views
1

我正在处理自定义单元格,当我在iOS 5模拟器上测试时,一切正常,但是当我在iOS 4模拟器上进行检查时出现问题。单元格背景图像的不透明度不工作xcode自定义单元格不透明度不适用于iOS 4

这是在iOS 4

http://i45.tinypic.com/fa0xl5.png enter image description here

,这是在iOS 5中,巫婆我希望它看起来像在iOS 4的

enter image description here

方法我真的使用是

-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 
cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"TabelCellEb.png"]]; 
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TabelCell.png"]];} 

,并在viewDidLoad对表格的背景是

self.tableView.backgroundColor = [UIColor clearColor]; 
self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"TableBackground.png"]]; 

任何想法如何解决这个问题?

UPDATE:这是使用小区BG图像我真的

enter image description here

它具有在其上的效果和30%的不透明度

UPDATE2:

新形象

enter image description here enter image description here

现在的背景图像与表与该代码

self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"TableBackground.png"]]; 

回答

0

我解决了这个问题更换后向上和向下移动,

我除去tableView willDisplayCell方法和加入此代码到tableView cellForRowAtIndexPath

UIImage *cellImage = [UIImage imageNamed:@"TabelCellMu.png"]; 
UIImageView *cellBackgroundImage = [[UIImageView alloc]initWithImage:cellImage]; 
cell.backgroundView = cellBackgroundImage; 
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TabelCell.png"]]; 

和一切在iOS 4和5都工作正常:)

相关问题