iOS:我将我的静态tableView分隔符设置为无,我可以在我的单元格中单独设置我的分隔符吗?

标签 ios uitableview

我将我的 static tableView 的分隔符设置为 none,我可以在单元格中设置我的 separator一个人吗?

在 Storyboard中,我将separator设置为none In the storyboar I set <code>separator</code> to <code>none</code>

这是将separator设置为none的结果,如何在单元格下添加行? This is the result of set <code>separator</code> to <code>none</code>, How can I add line under the cell?

如果我将分隔符设置为单行,则红色按钮上方有双线 If I set separator to <code>Single Line</code>, there is double line above the red button

最佳答案

可以将分隔符设置为无,然后在需要划线的单元格中画一条线。

UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, cellHeight - 1 / [UIScreen mainScreen].scale, [UIScreen mainScreen].bounds.size.width, 1 / [UIScreen mainScreen].scale)];
// (1 / [UIScreen mainScreen].scale) : 1px width line.
lineView.backgroundColor = [UIColor blackColor];
[self addSubview:lineView];

关于iOS:我将我的静态tableView分隔符设置为无,我可以在我的单元格中单独设置我的分隔符吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38088878/

相关文章:

ios - XIB 弹出窗口显示

ios - 在IDE中呈现ViewController黑屏或线程调试

iphone - 当单元格滚出 View 时,TableViewCell 的 textLabel 值返回到 1

ios - 如何按 id 或月份 : Descending (Latest Post First)? 对数组进行排序

ios - UISearchBar 不应关闭导航 Controller

ios - 按一个按钮它会发出声音。快速按下按钮,声音播放弹出和点击

ios - Tweetbot 横幅图像下拉以缩放图像

objective-c - 更好的性能设置 backgroundView : willDisplayCell or init?

ios - 使用 UICollectionView 的类似电子表格的布局

ios - 可调整大小的表格 View 单元格,其中包含 tableView