次の添付画像を参照してください。 から白い色を取り除きたい
UITableViewCell
。テーブルビューセルから白い色を取り除く方法.?
これが私のコードです:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell=nil;
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
Schedule *sch=(Schedule*)[tableDataList objectAtIndex:indexPath.row];
NSString*ptime=@"";
if(sch.ptime.length<8){
ptime=[ptime stringByAppendingString:@" "];
ptime=[ptime stringByAppendingString:sch.ptime];
}
else
{
ptime=[ptime stringByAppendingString:sch.ptime];
}
UILabel *lbPTime=[[UILabel alloc]initWithFrame:CGRectMake(5, 10, 80, 25)];
lbPTime.font=[UIFont fontWithName:@"Zawgyi-One" size:15];
lbPTime.textColor=[UIColor whiteColor];
[lbPTime setText:ptime];
NSString*pname=@"";
pname=[pname stringByAppendingString:sch.pname];
pname=[pname stringByAppendingString:@" "];
UILabel *lbPName=[[UILabel alloc]initWithFrame:CGRectMake(lbPTime.frame.size.width, 10, 250, 25)];
lbPName.font=[UIFont fontWithName:@"Zawgyi-One" size:15];
CGSize maximumLabelSize=CGSizeMake(296, 9999);
CGSize expectedLabelSize= [pname sizeWithFont:lbPName.font
constrainedToSize:maximumLabelSize
lineBreakMode:lbPName.lineBreakMode];
CGRect newFrame=lbPName.frame;
newFrame.size.height=expectedLabelSize.height;
newFrame.size.width=expectedLabelSize.width;
lbPName.frame=newFrame;
lbPName.numberOfLines=0;
lbPName.lineBreakMode=UILineBreakModeWordWrap;
lbPName.textColor=[UIColor whiteColor];
[lbPName setText:pname];
[cell.contentView addSubview:lbPTime];
[cell.contentView addSubview:lbPName];
[cell.contentView sizeToFit];
UIView *v = [[UIView alloc]init];
v.backgroundColor = self.tableview.backgroundColor;//[UIColor clearColor];
cell.selectedBackgroundView = v;
cell.backgroundColor=[UIColor clearColor];
return cell;
}