我試圖在右側設置分隔符插入。在項目的第一次運行和滾動tableview之前,一切都顯得平滑。但是,一旦滾動發生一次,每個部分中最後一行的分隔符插入將調整爲全部寬度。 使用的代碼如下: 在viewDidLoad
:UITableView分隔符插入在iOS7中滾動tableview時更改爲默認值
myTable.separatorColor = [UIColor redColor];
[myTable setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 40)];
內cellForRowAtIndexPath
:
[tableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 40)];
cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, 40);
我試圖把相同的代碼在UITableView
幾乎所有其他委託/數據源的方法,但都無濟於事。
UILabel *upperBorder = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 280.0, 1.0)];
[upperBorder setBackgroundColor:[UIColor blackColor]];
[headerView addSubview:upperBorder];
UILabel *lowerBorder = [[UILabel alloc]initWithFrame:CGRectMake(0, 39.0, 280.0, 1.0)];
[lowerBorder setBackgroundColor:[UIColor blackColor]];
[headerView addSubview:lowerBorder];
我已經把圖像:
若要執行插圖啄在表中的headerview,我已經在viewForHeaderInSection
(標題爲40的高度)增加了兩個UILabel
上部和下部具有受限框架寬度滾動前後。
滾動前:
滾動後:
在這方面的任何幫助表示讚賞。我只需要讓表格看起來像第一張圖片,即使在滾動之後也是如此,無論如何保留邊緣插入在右側。 在此先感謝。
非常感謝,工作正常:) – keepsmiling 2014-09-11 12:48:02