How to show Separator line for currently displaying cells in the UITableView using MonoTouch?
I have showing 5 to 8 items in the UITableView
. But Separator
line showing empty cells also. There are no value on that empty cells. Why Separator
line showing on these empty cells? I choose the Separa开发者_Go百科tor
value is Single Line
in Interface Builder. How to show Separator
line for currently displaying cells in the UITableView
using MonoTouch?
Look at the screenshot. I have showing 5 items in the UITableView
. But separator showing all the cells of UITableView
. I need separator line for used cells in the UITableView
.
If I understand you correctly, you want to eliminate empty cells from your UITableView
?
If yes, do this to clear out the empty cells/space below your data:
/// <summary>
/// Removes empty lines below a tableview. Attention: calls the table's delegate implicitly, so make sure it is initialized.
/// </summary>
public static void ClearEmptyTableViewSpacers ( UITableView oTableView )
{
UIView oViewSpacerClear = new UIView (new System.Drawing.RectangleF (0, 0, oTableView.Frame.Width, 10));
oViewSpacerClear.BackgroundColor = UIColor.Clear;
oTableView.TableFooterView = oViewSpacerClear;
}
It's not possible to say a seperator line only for special cells. The tableview always draws seperator lines for the complete height of the UITableView.
The only way to made this possible is to set the TableView SeperatorColor to Transparent and draw the Seperator Line within a Cell. But i think that's heavily drain performance on large lists.
精彩评论