iOS 8 UITableView 的分割线左对齐

1. 解决UITableView分割线距左边有距离的问题

我们在使用tableview时会发现分割线的左边会短一些,通常可以使用setSeparatorInset:UIEdgeInsetsZero 来解决。但是升级到XCode6之后,在iOS8里发现没有效果。下面给出解决办法:

viewDidLoad方法和willDisplayCell中加上如下代码:

if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {

[self.tableView setSeparatorInset:UIEdgeInsetsZero];

}

if ([self.tableView     respondsToSelector:@selector(setLayoutMargins:)]) {

[self.tableView setLayoutMargins:UIEdgeInsetsZero];

}
时间: 2024-12-06 20:49:05

iOS 8 UITableView 的分割线左对齐的相关文章

六、UITableView表的分割线左对齐

//分割线左对齐 -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPat{ if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } if ([cell

ios8 ios7 tableview cell 分割线左对齐

ios8中左对齐代码 //加入如下代码 -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) { [tableView setSeparatorInset:UIEdgeI

iOS7 iOS8 tableview separatorInset cell分割线左对齐

iOS7 和 iOS8 中tableview cell分割线左对齐的方法不一样,特此为以后需要做笔记. iOS7 中方法很简单,只需要设置 _table.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0); 而iOS8 中方法需要写一段代码: -(void)viewDidLayoutSubviews { if ([_table respondsToSelector:@selector(setSeparatorInset:)]) { [_table setS

iOS上让按钮文本左对齐问题

一,问题分析 1.在做历史记录视图的时候,由于让键盘退出后才能触发表格的 didselect 那个代理方法,也就是得点两下才触发,而表格中的按钮点一下就可以立即响应. 2.于是我就有了用按钮事件代替 cell 的代理方法. 3.本以为用 contentEdgeInset 和 titleLabel 的 textAlignment就能解决按钮文字的左对齐问题,结果都失败了. 4.结果上网一查,textAlignment"只是让标签中的文本左对齐,但并没有改变标签在按钮中的对齐方式." 5.

iOS UITextField中的文字左对齐,垂直高度居中

textField.textAlignment = UITextAlignmentLeft; //水平左对齐 textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;  //垂直居中

iOS 8 UITableViewCell 分割线 左对齐

//加入如下代码 -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{          if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {         [tableView setSeparatorInset:U

iOS8 tableview separatorInset cell分割线左对齐,ios7的方法失效了

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -(void)viewDidLayoutSubviews { if ([self.mytableview respondsToSelector:@selector(setSeparatorInset:)]) { [self.mytableview setSeparatorInset:UIEdgeInsetsZero]; } if ([self.mytableview respondsToSelect

iOS项目开发小技巧 (三) --UITableView实现Cell左划删除等自定义功能

今天来介绍下iOS开发中UITableView的Cell左划实现微信中置顶,删除等功能.该功能在iOS8.0以前是需要很复杂的实现,不过github上应该有现成demo,不过今天介绍的是在iOS8.0以后苹果新推出的api,来实现Cell左划自定义控件. 1. 首先创建UITableView视图,实现其俩个代理,UITableViewDelegate和UITableViewDataSource,该处代码就不说了,主要是俩个回调方法 -(UITableViewCell *)tableView:(U

ios uilable折行后文字怎么都是左对齐

typedef NS_ENUM(NSInteger, NSLineBreakMode) {        /* What to do with long lines */ NSLineBreakByWordWrapping = 0,         /* Wrap at word boundaries, default */ NSLineBreakByCharWrapping,        /* Wrap at character boundaries */ NSLineBreakByClip