本文整理汇总了C#中UITableViewCell.SetNeedsDisplay方法的典型用法代码示例。如果您正苦于以下问题:C# UITableViewCell.SetNeedsDisplay方法的具体用法?C# UITableViewCell.SetNeedsDisplay怎么用?C# UITableViewCell.SetNeedsDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableViewCell
的用法示例。
在下文中一共展示了UITableViewCell.SetNeedsDisplay方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WillDisplay
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
{
var updated = false;
var sectionData = GetSectionData(0);
var section = Sections[0];
if (section.Views.ContainsKey(cell))
{
var views = section.Views[cell];
if (views.Count > 0)
{
foreach (var view in views)
{
var dc = view as IDataContext<object>;
if (dc != null)
{
dc.DataContext = GetSectionData(0)[indexPath.Row];
}
var updateable = view as IUpdateable;
if (updateable != null)
{
updateable.UpdateCell(cell, indexPath);
cell.SetNeedsDisplay();
updated = true;
}
}
}
}
// Do default since no views have done an update
if (!updated)
{
if (IsRootCell)
{
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
cell.TextLabel.Text = Caption;
if (IsMultiselect && cell.DetailTextLabel != null)
{
cell.DetailTextLabel.Text = SelectedItems.Count.ToString();
}
else
{
if (SelectedItem != null)
{
if (ReplaceCaptionWithSelection)
cell.TextLabel.Text = SelectedItem.ToString();
else
if (cell.DetailTextLabel != null)
cell.DetailTextLabel.Text = SelectedItem.ToString();
}
}
}
else
{
if (sectionData.Count > 0 && sectionData[indexPath.Row] != null)
{
cell.TextLabel.AdjustsFontSizeToFitWidth = true;
cell.TextLabel.Text = sectionData[indexPath.Row].ToString();
}
else
Console.WriteLine("No Data: for row {0}, section {1}", indexPath.Row, indexPath.Section);
}
}
}
示例2: ThemeChanged
public void ThemeChanged(UITableViewCell cell)
{
if (cell == null)
return;
if (cell.TextLabel != null)
{
if (TextFont != null)
cell.TextLabel.Font = TextFont;
cell.TextLabel.TextAlignment = TextAlignment;
cell.TextLabel.TextColor = TextColor ?? cell.TextLabel.TextColor;
if (TextShadowColor != null)
cell.TextLabel.ShadowColor = TextShadowColor;
if (TextShadowOffset != SizeF.Empty)
cell.TextLabel.ShadowOffset = TextShadowOffset;
if (TextHighlightColor != null)
cell.TextLabel.HighlightedTextColor = TextHighlightColor;
}
if (cell.DetailTextLabel != null)
{
if (DetailTextFont != null)
cell.DetailTextLabel.Font = DetailTextFont;
cell.DetailTextLabel.TextAlignment = DetailTextAlignment;
cell.DetailTextLabel.TextColor = DetailTextColor ?? cell.DetailTextLabel.TextColor;
if (DetailTextShadowColor != null)
cell.DetailTextLabel.ShadowColor = DetailTextShadowColor;
if (DetailTextShadowOffset != SizeF.Empty)
cell.DetailTextLabel.ShadowOffset = DetailTextShadowOffset;
if (DetailTextHighlightColor != null)
cell.DetailTextLabel.HighlightedTextColor = DetailTextHighlightColor;
}
var elementCell = cell as UITableViewElementCell;
IImageUpdated element = null;
if (elementCell != null)
element = elementCell.Element as IImageUpdated;
if (CellBackgroundColor != null)
{
cell.BackgroundColor = CellBackgroundColor ?? UIColor.White;
}
else if (element != null && CellBackgroundUri != null)
{
var img = ImageLoader.DefaultRequestImage(CellBackgroundUri, element);
cell.BackgroundColor = img != null ? UIColor.FromPatternImage(img) : UIColor.White;
}
else if (CellBackgroundImage != null)
{
cell.BackgroundColor = UIColor.FromPatternImage(BackgroundImage);
}
else
{
cell.BackgroundColor = UIColor.White;
}
if (element != null && CellImageIconUri != null)
{
var img = ImageLoader.DefaultRequestImage(CellImageIconUri, element);
if (img != null)
{
var small = img.Scale(new SizeF(32, 32));
small = small.RemoveSharpEdges(5);
cell.ImageView.Image = small;
cell.ImageView.Layer.MasksToBounds = false;
cell.ImageView.Layer.ShadowOffset = new SizeF(2, 2);
cell.ImageView.Layer.ShadowRadius = 2f;
cell.ImageView.Layer.ShadowOpacity = 0.8f;
}
}
else if (CellImageIcon != null)
cell.ImageView.Image = CellImageIcon;
if (Accessory.HasValue)
cell.Accessory = Accessory.Value;
else
cell.Accessory = UITableViewCellAccessory.None;
cell.SetNeedsDisplay();
}
示例3: UpdateCell
public override void UpdateCell(UITableViewCell cell, NSIndexPath indexPath)
{
var composableListCell = cell as ComposableViewListCell;
if (composableListCell != null)
{
composableListCell.IndexPath = indexPath;
}
Type dataType = null;
var sectionData = GetSectionData(0);
GetItems();
if (sectionData.Count > 0)
{
dataType = sectionData[0].GetType();
}
if (DisplayMode != DisplayMode.RootCell)
{
if (dataType != null && (dataType.IsPrimitive || dataType.IsEnum) && (SelectionAction == SelectionAction.NavigateToView || SelectionAction == SelectionAction.Custom))
{
IsSelectable = false;
SelectionAction = SelectionAction.Custom;
}
}
else
{
if (dataType != null && ((dataType.IsPrimitive || dataType == typeof(string))) && (SelectionAction != SelectionAction.Custom || SelectionAction == SelectionAction.None))
{
IsNavigable = sectionData.Count > 1;
SelectionAction = SelectionAction.Selection;
if (sectionData.Count == 1)
{
SelectedItem = sectionData[0];
SetItems();
}
}
}
base.UpdateCell(cell, indexPath);
cell.SelectionStyle = IsNavigable ? UITableViewCellSelectionStyle.Blue : UITableViewCellSelectionStyle.None;
cell.SelectionStyle = IsSelectable ? UITableViewCellSelectionStyle.None : cell.SelectionStyle;
cell.SelectionStyle = SelectionAction == SelectionAction.Custom ? UITableViewCellSelectionStyle.Blue : cell.SelectionStyle;
SetSelectionAccessory(cell, indexPath);
cell.SetNeedsDisplay();
}
示例4: ThemeChanged
public void ThemeChanged(UITableViewCell cell)
{
_Cell = cell;
if (_Cell == null)
{
return;
}
if (_Cell.TextLabel != null)
{
if (TextFont != null)
{
_Cell.TextLabel.Font = TextFont;
}
_Cell.TextLabel.TextAlignment = TextAlignment;
_Cell.TextLabel.TextColor = TextColor ?? _Cell.TextLabel.TextColor;
if (TextShadowColor != null)
{
_Cell.TextLabel.ShadowColor = TextShadowColor;
}
if (TextShadowOffset != SizeF.Empty)
{
_Cell.TextLabel.ShadowOffset = TextShadowOffset;
}
if (TextHighlightColor != null)
{
_Cell.TextLabel.HighlightedTextColor = TextHighlightColor;
}
}
if (_Cell.DetailTextLabel != null)
{
if (DetailTextFont != null)
{
_Cell.DetailTextLabel.Font = DetailTextFont;
}
_Cell.DetailTextLabel.TextAlignment = DetailTextAlignment;
_Cell.DetailTextLabel.TextColor = DetailTextColor ?? _Cell.DetailTextLabel.TextColor;
if (DetailTextShadowColor != null)
{
_Cell.DetailTextLabel.ShadowColor = DetailTextShadowColor;
}
if (DetailTextShadowOffset != SizeF.Empty)
{
_Cell.DetailTextLabel.ShadowOffset = DetailTextShadowOffset;
}
if (DetailTextHighlightColor != null)
{
_Cell.DetailTextLabel.HighlightedTextColor = DetailTextHighlightColor;
}
}
if (CellBackgroundColor != null)
{
_Cell.BackgroundColor = CellBackgroundColor;
}
else if (CellBackgroundImage != null)
{
_Cell.BackgroundColor = UIColor.FromPatternImage(CellBackgroundImage);
}
else
{
_Cell.BackgroundColor = UIColor.White;
}
ConfigureBackgroundImage();
_Cell.SetNeedsDisplay();
}