IOS开发之----设置UITableView背景色和选中背景色

UIView* tempView=[[UIView alloc] initWithFrame:cell.frame];

tempView.backgroundColor = [UIColor colorWithRed:230.0/255.0 green:247.0/255.0 blue:254.0/255.0 alpha:1.0];
   
cell.backgroundView = tempView;  //更换背景色     不能直接设置backgroundColor
   
UIView* tempView1=[[UIView alloc] initWithFrame:cell.frame];
tempView1.backgroundColor = [UIColor whiteColor];
   
cell.selectedBackgroundView = tempView1;

猜你喜欢

转载自iaiai.iteye.com/blog/2120131