简体   繁体   English

禁用特定UITableView部分的分隔符

[英]Disabling separator for a specific UITableView section

I'm designing a Login page and I'm using a table with 3 section. 我正在设计一个“登录”页面,并且正在使用一个包含3个部分的表。

First section: 1 cell containing header image Second section: 2 cells for username and password Third section: 1 cell for login button. 第一部分:1个包含标题图像的单元格第二部分:2个用于用户名和密码的单元格第三部分:1个用于登录按钮的单元格

3节设计

I would like to disable the separator for only for the 1st and 3rd section cells and leaving it active for the 2nd section. 我只想对第一个和第三个部分的单元格禁用分隔符,并在第二个部分中将其保持活动状态。 At the moment I can only enable/disable the separator for all the cells. 目前,我只能为所有单元格启用/禁用分隔符。

Any solution? 有什么办法吗?

Thanks a lot 非常感谢

Claus 克劳斯

This might be a dirty way to do this, but you could disable the separators (as I don't think you can control them on a cell-level, but I could be wrong here), and draw the line manually? 这可能是一种肮脏的方法,但是您可以禁用分隔符(因为我认为您不能在单元级别上控制它们,但是我在这里可能错了),并手动绘制线条?

You could, like, use a stretchable UIImage and put a gray pixel png into it, then stretch it to fill the cell width. 您可以使用可拉伸的UIImage并将灰色像素png放入其中,然后将其拉伸以填充单元格宽度。 This would allow you to even pick the color of the separator :-) Or just insert an UIView and set its backgroundcolor. 这甚至允许您选择分隔符的颜色:-)或仅插入UIView并设置其backgroundcolor。 Whatever you like. 随你喜欢。

Edit: On a side note, I'm not sure why you're using an UITableView anyway. 编辑:在旁注,我不确定为什么您仍然使用UITableView。 You're not taking advantage of any feature of UITableView here (like scrolling, lazy loading, anything at all). 您没有在这里利用UITableView的任何功能(例如滚动,延迟加载,所有功能)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM