简体   繁体   中英

add finishing separator on uitableview

I have a custom separator style (fairly simple):

[[UITableView appearance] setSeparatorColor:SOMECOLOR];

Now I want to have my tableview finish with a separator. Currently separators only appear between two cells, but I want to have a separator at the end.

see here:

没有分隔符出现

any ideas how this could be done?

I usually make my own separator inside the table view cell. I do this with a UIView that spans the width of the cell and is 1 or 2 points high.

In your case, if you want the system separator, you would have to add a custom cell at the end which is all transparent and 1 point high. UITableView would then add the missing separator.

I understand it you want a separator at the end as well? You can add a footer view to achieve this effect.

Make a footer view with height of 0.0001. To do so simply implement the following tableview delegate method :

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 0.001; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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