Reputation: 127
In the below image,
I want to hide separator line start Starting from the fifth,
- (void)viewDidLoad
{
[super viewDidLoad];
self.mainTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
[self.mainTableView setDelegate:self];
[self.mainTableView setDataSource:self];
[self.view addSubview:self.mainTableView];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 4; //4 row
}
Upvotes: 3
Views: 2063
Reputation: 8444
Add this tableview delegate method to your code
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.001f;
}
This will show the separator line only to the rows which have content
Upvotes: 9