Saturday, June 8, 2013

UITableViewCell UITableViewCellSeparatorStyleSingleLineEtched example in Objective C (iOS).


UITableViewCell UITableViewCellSeparatorStyleSingleLineEtched

Cell Separator Style
The style for cells used as separators.

typedef enum {
UITableViewCellSeparatorStyleNone,
UITableViewCellSeparatorStyleSingleLine,
UITableViewCellSeparatorStyleSingleLineEtched
} UITableViewCellSeparatorStyle;

Constants
UITableViewCellSeparatorStyleNone
The separator cell has no distinct style.
UITableViewCellSeparatorStyleSingleLine
The separator cell has a single line running across its width. This is the default value
UITableViewCellSeparatorStyleSingleLineEtched
The separator cell has double lines running across its width, giving it an etched look. This style is currently only supported for grouped-style table views.

Discussion of [UITableViewCell UITableViewCellSeparatorStyleSingleLineEtched]
You use these constants to set the value of the separatorStyle property defined by UITableView.

UITableViewCell UITableViewCellSeparatorStyleSingleLineEtched example.
  [TableView setSeparatorStyle: UITableViewCellSeparatorStyleSingleLineEtched];

  [TableView setSeparatorColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"Divider_line@2x.png"]]];

Example of [UITableViewCell UITableViewCellSeparatorStyleSingleLineEtched].
if ([[self.fetchedResultsController fetchedObjects] count] == 0)
{
    self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLineEtched;
    self.routineTableView.separatorColor = [UIColor clearColor];
}
else
{
     self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; // or you have the previous 'None' style...
    self.routineTableView.separatorColor = [UIColor grayColor];
}

End of UITableViewCell UITableViewCellSeparatorStyleSingleLineEtched example article.