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

2018-01-02  本文已影响20人  UILabelkell

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;
}

上一篇 下一篇

猜你喜欢

热点阅读