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.
Asked
Active
Viewed 3,102 times
3
-
3its better you use imageView into your tableViewCells – Apr 29 '16 at 04:36
-
1look at this [demo](https://github.com/edekhayser/Timeline) – Sneha Apr 29 '16 at 04:42
-
I will try to do that. thank for help :) – Telember Apr 29 '16 at 04:48
-
2@AbhinandanPratap Instead of Image, it would be better to have UIView having width 1 pixel & background colour Black Or whatever you want (Just not white or clearColor).. – Sneha Apr 29 '16 at 04:50
2 Answers
9
You can get this by using adding UIView to CustomCell like this..
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