2

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.
enter image description here

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

3 Answers3

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
  • just look at my edit – Saurabh Prajapati Dec 09 '15 at 03:47
  • @IanKunneke You need to add the viewWillAppear method yourself, it is not already there. – Sman25 Dec 09 '15 at 03:50
  • 1
    In 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