美文网首页
设置UITableView背景色和选中背景色

设置UITableView背景色和选中背景色

作者: UILabelkell | 来源:发表于2018-01-02 23:48 被阅读20次

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

tempView.backgroundColor= [UIColorcolorWithRed:230.0/255.0green:247.0/255.0blue:254.0/255.0alpha:1.0];

cell.backgroundView= tempView; //更换背景色 不能直接设置backgroundColor

UIView* tempView1=[[UIViewalloc]initWithFrame:cell.frame];
tempView1.backgroundColor = [UIColor whiteColor];

cell.selectedBackgroundView= tempView1;

//快速排序
+(NSMutableArray *)arrayObject:(NSMutableArray *)array
{
[array sortUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
if ([obj1 integerValue] < [obj2 integerValue])
{
return NSOrderedDescending;
}
else
{
return NSOrderedAscending;
}
}];
return array;
}

相关文章

网友评论

      本文标题:设置UITableView背景色和选中背景色

      本文链接:https://www.haomeiwen.com/subject/emecnxtx.html