views:

6123

answers:

6

I have subclassed the UITableView control, and the style is grouped, but I do not need the cell separators. I tried setting my table view's separatorStyle to none, but it doesn't work. Can any one help me out?

A: 

It appears that (a) the thinnest you can get s inline separators and (b) you can't change the style after you create the UITableView. From the docs:

Table View Style

The style of the table view.

typedef enum {
   UITableViewStylePlain,
   UITableViewStyleGrouped
} UITableViewStyle;

Constants

UITableViewStylePlain

A plain table view. Any section headers or footers are displayed as inline separators and float when the table view is scrolled.

Available in iPhone OS 2.0 and later.

Declared in UITableView.h

UITableViewStyleGrouped

A table view whose sections present distinct groups of rows. The section headers and footers do not float.

Available in iPhone OS 2.0 and later.

Declared in UITableView.h

Discussion

You set the table style when you initialize the table view (see initWithFrame:style:). You cannot modify the style thereafter.

Olie
+2  A: 

How about setSeparatorColor to your cell's background color?

leonho
this might help , i'll try that out ...
I tried tht but there is no property called seperatorColor .i have subclassed the cell also , so in the cell's init i have done foll :self.separatorStyle = UITableViewCellSeparatorStyleNone;but its gives compile time error :(
I think you misspell it. It is separatorColor.
leonho
You could try using [UIColor clearColor], too.
Alex
i have used the proper spelling , But these properties are avaiable only for the table view .I want to set the peoperty for the UiTableViewCell obj. As they have mentioned in the reference that the cell separator properties need to be set . I donno y cell and table prop has 2 b set. :(
+12  A: 

Use tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

+1  A: 

This did the trick for me:

[dayTableView setSeparatorColor:[UIColor whiteColor]]; //or your background color
Akshay Shah
thanks a lot that is the correct way.
Ayaz Alavi
+1  A: 

And in case you're using Interface Builder, select your UITableView and find "Table View Attributes" (press command-1).

At top you have "Table View" and under it as second item "Separator". Set it as "None". Can't get much easier than that!

JOM
+1  A: 

In a grouped table view, setting separatorStyle doesn't do anything. If you want to hide it, just do the following:

tableView.separatorColor = [UIColor clearColor];
Sam Soffes