1. The system comes with the form of centralized dividing line mytableview.separatorstyle=uitableviewcellseparatorstylenone; (This is to remove all split lines) can be set by this
2. Also set the custom cell first by Mytableview.separatorstyle=uitableviewcellseparatorstylenone this method to remove all cells, Then in the overloaded cell DrawRect method, through the quartz 2D technology directly to draw, the idea is as follows, first draw the entire cell background color, and then draw the dividing line at the bottom of the cell, below this can set the split line style width and height of the code snippet as follows:
Self-painted split line (seemingly in the iOS7 does not work, on the IOS7 can use the following method) the following method to draw the split line is still not perfect (more than one section of the time below will be a more, do not know how to solve)
-(void) DrawRect: (cgrect) rect
{
Cgcontextref context = Uigraphicsgetcurrentcontext ();
Cgcontextsetfillcolorwithcolor (context, [Uicolor Whitecolor]. Cgcolor);
Cgcontextfillrect (context, rect);
Cgcontextsetstrokecolorwithcolor (context, [Uicolor colorwithred:0xe2/255.0f green:0xe2/255.0f blue:0xE2/255.0f Alpha:1]. Cgcolor);
Cgcontextstrokerect (context, CGRectMake (0, Rect.size.height-1, rect.size.width, 1));
}
In addition, if the iOS7 only want to change the width of the split line position, etc. can be set because this setting only in iOS7 and above can
if ([[[[Uidevice Currentdevice] systemversion] Floatvalue] >= 7) {
Cell.separatorinset = Uiedgeinsetsmake (0, 50, 0, 0);//upper left and right can be set by setting these four parameters to set the split line
}
3. Sometimes it is necessary to remove the extra dividing line to achieve this method through the method of-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: ( Nsindexpath *) Indexpath This method is implemented as follows://Remove the extra cell divider line
if (tableview.datasource>0) {
Tableview.separatorstyle=uitableviewcellseparatorstylesingleline;
[Self setextracelllinehidden:tableview];
}else{
Tableview.separatorstyle=uitableviewcellseparatorstylenone;
}
After this judgment, call the following method to achieve the data when there is no data when there is no split line
-(void) Setextracelllinehidden: (UITableView *) TableView
{
UIView *view =[[UIView alloc]init];
View.backgroundcolor = [Uicolor Clearcolor];
[TableView Settablefooterview:view];
[View release];
}
IOS TableView Split Line height customization