Ok this might be a very simple answer but I'm still pretty fresh when it comes to iOS development. I'm creating a simple app just to play with different concepts and the problem I am having with my TableViewController is the excess lines. To be clear I will post a picture and circle what I am talking about, and my question is how do I make it to where the only lines showing are the ones where cells are actually populated so in my case the first 3 cells and I circled the unwanted lines.
Asked
Active
Viewed 80 times
2

Cœur
- 37,241
- 25
- 195
- 267

Ian Kunneke
- 67
- 5
-
just add Tablefooterview.like "Table.tableFooterView = [UIView new];" – Saurabh Prajapati Dec 09 '15 at 03:36
-
This is the cutest question I've seen on this site :-) – Sergey Kalinichenko Dec 09 '15 at 03:38
-
@SaurabhPrajapati would I put that in View did load?? If not where else? – Ian Kunneke Dec 09 '15 at 03:40
-
viewWillAppear is better place for this code. – Saurabh Prajapati Dec 09 '15 at 03:41
3 Answers
2
It's simple. there is so many answer there on stackOverflow for this. just add Footerview to your tableview.add following code in viewWillAppear
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UITableView *tableView; //this is your tableview
tableView.tableFooterView = [UIView new];
}

Sman25
- 1,605
- 13
- 17

Saurabh Prajapati
- 2,348
- 1
- 24
- 42
-
If I sound stupid I'm sorry but there is no viewWillAppear in my code, i even used the finder to search for it, i tried this code in viewdidload and it didn't work. There is no way to do it in Storyboard? – Ian Kunneke Dec 09 '15 at 03:45
-
-
@IanKunneke You need to add the viewWillAppear method yourself, it is not already there. – Sman25 Dec 09 '15 at 03:50
-
1In the future, if you know the question is a duplicate, flag the question as a duplicate instead of posting yet another answer. – rmaddy Dec 09 '15 at 04:08
2
add These codes to your .m file:
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.tableView.tableFooterView =[[UIView alloc] initWithFrame:CGRectZero]; //set your tableView's tableFooterView
}

FisherMartyn
- 826
- 1
- 8
- 17
0
You just have to drag a UIView into the TableView in InterfaceBuilder , then set the UIView instance height to 1px and it's background color to [UIColor clearColor].
And if you don't use InterfaceBuilder , you can make the same UIView instance in your code and set the instance to tableview.tableFooterView.

EI CHO
- 86
- 6