内容简介:翻译自:https://stackoverflow.com/questions/24748025/how-to-remove-uitableview-offset-on-the-left-in-swift
我找到了一些问题和答案来删除ios7中UITableViews的偏移量,即这里的这个
How to fix UITableView separator on iOS 7?我想知道是否有人遇到了正确的功能来删除插入边距.在objective-c中类似于这个答案的东西
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
就像Objective-C示例一样,但转换为swift.我自己遇到了一些麻烦.如果您在UITableViewController中执行此代码,则此代码在UITableView中工作,您可以将self.tableView替换为self:
// iOS 7
if(self.respondsToSelector(Selector("setSeparatorInset:"))){
self.separatorInset = UIEdgeInsetsZero
}
// iOS 8
if(self.respondsToSelector(Selector("setLayoutMargins:"))){
self.layoutMargins = UIEdgeInsetsZero;
}
对于单元格(仅限iOS 8),将以下代码放在以下函数中:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
获取单元格,并设置以下属性:
// iOS 8
if(cell.respondsToSelector(Selector("setLayoutMargins:"))){
cell.layoutMargins = UIEdgeInsetsZero;
}
翻译自:https://stackoverflow.com/questions/24748025/how-to-remove-uitableview-offset-on-the-left-in-swift
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 记一次Access偏移注入
- ios – reloadRowsAtIndexPaths时保持偏移量
- Kafka 消息偏移量的维护
- Spark Streaming 之 Kafka 偏移量管理
- php-rdkafka手动提交偏移量
- 人品爆发:偏移注入与移位溢注的联合使用
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Pattern Recognition and Machine Learning
Christopher Bishop / Springer / 2007-10-1 / USD 94.95
The dramatic growth in practical applications for machine learning over the last ten years has been accompanied by many important developments in the underlying algorithms and techniques. For example,......一起来看看 《Pattern Recognition and Machine Learning》 这本书的介绍吧!