user891268
user891268

Reputation: 1425

How to fix border in UITableView for the UITableViewStyleGrouped

For a UITableViewStyleGrouped UITableView a small extra line is drawn below the tableview

How do I fix this?

I have tried my best. No luck so far.

Thank's in advance.

My Code

-(void)myTableView
{
//  if(mytableView != nil)
//  [mytableView release];

    if (mytableView == nil) {

        mytableView = [[UITableView alloc]initWithFrame:myFrame style:UITableViewStyleGrouped];

    }
    mytableView.delegate=self;
    mytableView.dataSource=self;
    mytableView.backgroundView=nil;
    mytableView.scrollEnabled = FALSE;
    [self.view addSubview:mytableView];
    [self myPortraitMode];
}

Background of the table is fixed is an image.

Upvotes: 1

Views: 923

Answers (2)

Code Monkey
Code Monkey

Reputation: 988

I think what you are referring to is the Bevel color of the table view. The answer is in this post. Basically, you need to set the table separatorStyle to UITableViewCellSeparatorStyleNone or to UITableViewCellSeparatorStyleSingleLine.

Upvotes: 2

hypercrypt
hypercrypt

Reputation: 15376

You need to set a background view:

UIView *backgroundView = [[UIView alloc] init];
backgroundView.backgroundColor = [UIColor yourColor];
tableview.backgroundView = backgroundView;
[backgroundView release];

You don't need to set the properties every time.

-(void)myTableView
{
    if (mytableView == nil) {
        mytableView = [[UITableView alloc]initWithFrame:myFrame style:UITableViewStyleGrouped];
        mytableView.delegate=self;
        mytableView.dataSource=self;
        mytableView.backgroundView=nil;
        mytableView.scrollEnabled = NO;
        [self.view addSubview:mytableView];
        [self myPortraitMode];
    }
}

I don't really see what the problem is though.

Upvotes: 1

Related Questions