how to make the background of UITableView cell transparent in iphone?
I wrote the following code to make my cell transparent as I do with UITableView
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Nsubject";
SubjectsCell *cell = (SubjectsCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"mySubjectCell" owner:self options:nil];
cell=subjCell;
UIView* backgroundView = [ [ [ UIView alloc ] initWithFrame:CGRectZero ] autorelease ];
cell.backgroundView = backgroundView;
for ( UIView* view in cell.contentView.subviews )
{
view.backgroundColor = [ UIColor clearColor ];
}
}
[cell SetTitle:[subjectsArr objectAtIndex:indexPath.row]];开发者_JS百科
return cell;
}
anybody can help me
In viewDidLoad you can simply add
self.tableView.backgroundColor = [UIColor clearColor];
You do not need to make your own view like you have above.
精彩评论