为UITableViewCell设置彩色边框

时间:2016-01-05 21:30:35

标签: ios objective-c uitableview

我希望我的tableview单元格有彩色边框和圆角。那是我尝试过的:

>>> from django.db import models
>>> from a1.models import Foo, Bar
>>> 
>>> f1 = Foo.objects.create(aaa=5)
>>> f2 = Foo.objects.create(aaa=8)
>>> f3 = Foo.objects.create(aaa=1)
>>> f4 = Foo.objects.create(aaa=12)
>>> f5 = Foo.objects.create(aaa=3)
>>> 
>>> b1 = Bar.objects.create(foo=f2, bbb=True)
>>> b2 = Bar.objects.create(foo=f1, bbb=True)
>>> b3 = Bar.objects.create(foo=f5, bbb=False)
>>> b4 = Bar.objects.create(foo=f3, bbb=True)
>>> b5 = Bar.objects.create(foo=f2, bbb=True)
>>> b6 = Bar.objects.create(foo=f3, bbb=True)
>>> b7 = Bar.objects.create(foo=f4, bbb=True)
>>> b8 = Bar.objects.create(foo=f5, bbb=False)
>>> b9 = Bar.objects.create(foo=f4, bbb=False)
>>> b10 = Bar.objects.create(foo=f5, bbb=True)
>>> b11 = Bar.objects.create(foo=f4, bbb=True)
>>> b12 = Bar.objects.create(foo=f4, bbb=True)
>>> b13 = Bar.objects.create(foo=f4, bbb=True)
>>> b14 = Bar.objects.create(foo=f4, bbb=True)
>>> b15 = Bar.objects.create(foo=f4, bbb=True)
>>> 
>>> Foo.objects.filter(bar__bbb=True).count()
12
>>> Foo.objects.filter(bar__bbb=True).aggregate(models.Sum("aaa"))['aaa__sum']
98
>>> Foo.objects.filter(bar__bbb=True).distinct().count()
5
>>> Foo.objects.filter(bar__bbb=True).distinct().aggregate(models.Sum("aaa"))['aaa__sum']
29

然而,左右边界有奇怪的“白色三角形”。请看一下:

enter image description here

如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

确保表格视图的背景颜色清晰,并检查cell.opaque = NO;

答案 1 :(得分:1)

使用viewDidLoad方法

[self.tableView setBackgroundView:[[UIView alloc] init]];
[self.tableView setBackgroundColor:UIColor.clearColor];
相关问题