3

In my project i have to add vertical lines but I don't know how to add a vertical line . I tried to add it into my UITableView but it can't.

Example

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Telember
  • 455
  • 6
  • 24

2 Answers2

9

You can get this by using adding UIView to CustomCell like this..

enter image description here

in TableView Data Source Method cellForRowAtIndexPath, check for first cell & last Cell. if first cell then hide LineUpper & if Last cell Then hide LineLower..

That's it..

Hope this would solve your Problem. :)

Sneha
  • 880
  • 9
  • 24
  • I want to add dashed line , for upper and lower line , and my cell height increase with the automaticdimension. I tried writing dimension . Even tried with the writing custom base class during my research. The problem the dash is not consistent. Please suggest me appropriate way to do so... Thanks – Charmi Aug 16 '17 at 07:12
  • You just need to draw dashed line in view after that view is loaded... reference this link: https://stackoverflow.com/questions/12701825/drawing-dashed-line-using-calayer – Sneha Aug 17 '17 at 04:53
1

you can add uiview in cellforrowAtindexpath programatically. If odd IndexPath then add view(line) below Imageview(bus image) else add view(line)above Imageview. Another answer is also good solution if you want to manage from interface builder.

Hope this will help :)

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75