ios8 UITableView设置 setSeparatorInset UIEdgeInsetsZero不起作用的解决办法(去掉15px空白间距)_IOS

但是在ios8中,设置setSeparatorInset:UIEdgeInsetsZero 已经不起作用了。下面是解决办法:

首先在viewDidLoad方法加入以下代码:

if(leftTable!.respondsToSelector("setLayoutMargins:")){
leftTable?.layoutMargins=UIEdgeInsetsZero
}
if(leftTable!.respondsToSelector("setSeparatorInset:")){
leftTable!.separatorInset=UIEdgeInsetsZero;
}

然后在UITableView的代理方法中加入以下代码:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if(cell!.respondsToSelector("setLayoutMargins:")){
cell!.layoutMargins=UIEdgeInsetsZero
}
if(cell!.respondsToSelector("setSeparatorInset:")){
cell!.separatorInset=UIEdgeInsetsZero;
}
}

这样不出意外的话,Table的分割线就没有空白间距了。

以上内容给大家介绍了ios8 UITableView设置 setSeparatorInset UIEdgeInsetsZero不起作用的解决办法(去掉15px空白间距),希望对大家以上帮助!

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索ios8_uitableview
separatorinset 无效、ios separatorinset、separatorinset 靠边、separatorinset、cell separatorinset,以便于您获取更多的相关知识。

时间: 2024-09-24 07:28:35

ios8 UITableView设置 setSeparatorInset UIEdgeInsetsZero不起作用的解决办法(去掉15px空白间距)_IOS的相关文章

基于js disabled="false"不起作用的解决办法

js使某表单元素不能访问:document.getElementById("text_id").disabled="true"; 如果想取消时用:document.getElementById("text_id").disabled="false";不会起作用. 正确写法为:document.getElementById("text_id").disabled=false;去掉引号 或者:document.

基于js disabled="false"不起作用的解决办法_javascript技巧

js使某表单元素不能访问:document.getElementById("text_id").disabled="true"; 如果想取消时用:document.getElementById("text_id").disabled="false";不会起作用. 正确写法为:document.getElementById("text_id").disabled=false;去掉引号 或者:document.

windows更新提示某些设置由你的系统管理员管理的解决办法

  正常情况下,只有加入域的用户会遇到此提示.如果只是个人用户,并没有加入过域,遇到此提示,应该是相关设置或者权限被修改了. 对此,我们可以尝试以下两种办法来解决这个问题: 方法一:对于专业版及以上版本的系统,可以修改组策略来解决问题 1.在开始搜索框中键入 gpedit.msc, 回车,打开组策略编辑器. 2.若弹出用户账户控制窗口,请允许以继续. 3.依次定位到下面位置:用户配置--管理模板--Windows 组件--Windows Update 4.确认关于Windows Update 的

MySQL中max_allowed_packet设置过小导致记录写入失败的解决办法

mysql根据配置文件会限制server接受的数据包大小. 有时候大的插入和更新会受max_allowed_packet 参数限制,导致写入或者更新失败. 查看目前配置 show VARIABLES like '%max_allowed_packet%'; 显示的结果为: +--------------------+---------+ | Variable_name | Value | +--------------------+---------+ | max_allowed_packet

jquery(live)中File input的change方法只起一次作用的解决办法_jquery

错误写法 复制代码 代码如下: $("#uploadImg").click(function(){ do something }); 正确写法 复制代码 代码如下: $("#uploadImg").live('change',function(){ do something });

Chrome内核下由ashx输出的js代码不起作用的解决方法_实用技巧

复制代码 代码如下: public class Script    {       public static void Alert(string message)        {            ResponseScript("    alert('" + message + "');");        }         public static void ResponseScript(string script)        {         

java-socket设置setsotimeout后为什么没有作用?

问题描述 socket设置setsotimeout后为什么没有作用? try { ServerSocket serverSocket=null; serverSocket=new ServerSocket(1989); Socket socket=serverSocket.accept(); serverSocket.setSoTimeout(2000); int temp=0; String chan_name; long chan_id; int chan_lock; int chan_sk

伪静态- .htaccess中设置 RewriteCond %{HTTP_HOST} 不起作用

问题描述 .htaccess中设置 RewriteCond %{HTTP_HOST} 不起作用 ```RewriteEngine on RewriteCond %{HTTP_HOST} ^aaa$ [NC] RewriteRule ^([a-zA-Z]+/)+list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$2&page=$3 RewriteRule ^([a-zA-Z]+/)+sh

.net2005开发编译时提示HTML验证错误,在选项中文本编辑HTML验证去掉后,不出现错误,可是过一会又出现了,设置好象不起作用?

问题描述 .net2005开发编译时提示HTML验证错误,在选项中文本编辑HTML验证去掉后,不出现错误,可是过一会又出现了,设置好象不起作用? 解决方案 解决方案二:把HTMLSourceEditing工具条的"TargetSchemaforvalidation"的下拉列表,选取InternetExplorer6.0