本文整理汇总了C#中UITableView.DequeueReusableCell方法的典型用法代码示例。如果您正苦于以下问题:C# UITableView.DequeueReusableCell方法的具体用法?C# UITableView.DequeueReusableCell怎么用?C# UITableView.DequeueReusableCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableView
的用法示例。
在下文中一共展示了UITableView.DequeueReusableCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCell
public override UITableViewCell GetCell(UITableView tv)
{
RectangleF frame;
if (datePicker == null)
{
label = new UILabel
{
Text = Caption
};
label.SizeToFit();
frame = label.Frame;
frame.X = 15;
frame.Y = 5;
label.Frame = frame;
datePicker = CreatePicker();
}
if(datePicker.Date != DateValue)
datePicker.Date = DateValue;
frame = datePicker.Frame;
frame.Y = frame.X = 0;
datePicker.Frame = frame;
var cell = tv.DequeueReusableCell("datePicker") ?? new UITableViewCell(UITableViewCellStyle.Default, "datePicker") { Accessory = UITableViewCellAccessory.None };
cell.ContentView.Add(label);
if(cell.ContentView != datePicker.Superview)
cell.ContentView.Add(datePicker);
return cell;
}
示例2: GetCell
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell;
if (indexPath.Section == 0)
{
if (indexPath.Row == 0)
{
var cellIdentifier = "Section1Row1";
cell = tableView.DequeueReusableCell(cellIdentifier);
if (cell == null)
cell = new UITableViewCell(UITableViewCellStyle.Default, cellIdentifier);
cell.TextLabel.Text = "帅酷天天东北烧烤";
cell.TextLabel.TextColor = UIColor.Gray;
}
else
{
var cellIdentifier = "Section1Row2";
cell = tableView.DequeueReusableCell(cellIdentifier);
if (cell == null)
cell = new UITableViewCell(UITableViewCellStyle.Default, cellIdentifier);
cell.TextLabel.Text = "滨湖区蠡湖街道湖滨商业街8-19";
cell.TextLabel.TextColor = UIColor.Gray;
cell.TextLabel.Font = UIFont.SystemFontOfSize(12);
}
}
else
{
cell = new UITableViewCell(UITableViewCellStyle.Default, "CategorySection");
}
return cell;
}
示例3: GetCell
private IPriceTileCell GetCell(UITableView tableView, PriceTileModel model) {
IPriceTileCell priceTileCell = null;
switch (model.Status) {
case PriceTileStatus.Done:
case PriceTileStatus.DoneStale:
priceTileCell = tableView.DequeueReusableCell (PriceTileTradeAffirmationViewCell.Key) as PriceTileTradeAffirmationViewCell;
if (priceTileCell == null) {
priceTileCell = PriceTileTradeAffirmationViewCell.Create ();
}
break;
case PriceTileStatus.Streaming:
case PriceTileStatus.Executing:
priceTileCell = tableView.DequeueReusableCell (PriceTileViewCell.Key) as PriceTileViewCell;
if (priceTileCell == null) {
priceTileCell = PriceTileViewCell.Create ();
}
break;
case PriceTileStatus.Stale:
priceTileCell = tableView.DequeueReusableCell (PriceTileErrorViewCell.Key) as PriceTileViewCell;
if (priceTileCell == null) {
priceTileCell = PriceTileErrorViewCell.Create ();
}
break;
}
return priceTileCell;
}
示例4: GetCell
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
if (indexPath.Row != 0) {
var cell = tableView.DequeueReusableCell (cellIdentifier) as NewsCell;
if (cell == null) {
cell = new NewsCell (cellIdentifier);
}
if (!string.IsNullOrEmpty (items [indexPath.Row - 1].Img)) {
// set the cell props
// we subtract one from the index because of the featured cell
cell.SetNewsCell (items [indexPath.Row - 1].Title, items [indexPath.Row - 1].Category,
items [indexPath.Row - 1].Img);
}
else {
cell.SetNewsCell (items [indexPath.Row - 1].Title, items [indexPath.Row - 1].Category, UIImage.FromFile("./Assets/imgholder.png"));
}
cell.ContentView.BackgroundColor = UIColor.FromRGB (26, 26, 26);
return cell;
}
else {
var cell = tableView.DequeueReusableCell(cellIdentifier) as FeaturedCell;
if (cell == null) {
cell = new FeaturedCell (cellIdentifier);
}
for (int i = 0; i < 4; i++) {
cell.SetFeaturedCell (featured);
}
cell.ContentView.BackgroundColor = UIColor.FromRGB (26, 26, 26);
return cell;
}
}
示例5: GetCell
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
// in a Storyboard, Dequeue will ALWAYS return a cell,
if (!isHeader) {
HocPhiCell cell = tableView.DequeueReusableCell (cellIdentifier) as HocPhiCell;
if (cell == null) {
cell = new HocPhiCell (cellIdentifier);
}
MonHoc mh = BMonHoc.GetMH (SQLite_iOS.GetConnection (), tableItems [indexPath.Row].MaMH);
cell.UpdateCell (mh.TenMH, tableItems [indexPath.Row].HocPhi, tableItems [indexPath.Row].MienGiam,
tableItems [indexPath.Row].PhaiDong);
if (indexPath.Row % 2 != 0) {
cell.BackgroundColor = UIColor.FromRGBA((float)0.8, (float)0.8, (float)0.8, (float)1);
}
else {
cell.BackgroundColor = UIColor.White;
}
return cell;
// now set the properties as normal
} else {
HPHeaderCell cell = tableView.DequeueReusableCell (cellIdentifier) as HPHeaderCell;
if (cell == null) {
cell = new HPHeaderCell (cellIdentifier);
}
return cell;
}
}
示例6: GetOrCreateCellFor
protected override UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item)
{
if (this._iosVersion6Checker.IsVersionOrHigher)
return tableView.DequeueReusableCell(this.CellIdentifier, indexPath);
return tableView.DequeueReusableCell(this.CellIdentifier);
}
示例7: GetCell
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
// in a Storyboard, Dequeue will ALWAYS return a cell,
if (!isHeader) {
DiemThiCell cell = tableView.DequeueReusableCell (cellIdentifier) as DiemThiCell;
if (cell == null) {
cell = new DiemThiCell (cellIdentifier);
}
var monhoc = BMonHoc.GetMH (SQLite_iOS.GetConnection (), tableItems [indexPath.Row].MaMH);
cell.UpdateCell (monhoc.TenMH, monhoc.TiLeThi.ToString(), tableItems [indexPath.Row].DiemKT,
tableItems [indexPath.Row].DiemThi,tableItems [indexPath.Row].DiemTK10,tableItems [indexPath.Row].DiemChu);
if (indexPath.Row % 2 != 0) {
cell.BackgroundColor = UIColor.FromRGBA((float)0.8, (float)0.8, (float)0.8, (float)1);
}
else {
cell.BackgroundColor = UIColor.White;
}
return cell;
// now set the properties as normal
} else {
DiemThiCell cell = tableView.DequeueReusableCell (cellIdentifier) as DiemThiCell;
if (cell == null) {
cell = new DiemThiCell (cellIdentifier,true);
}
return cell;
}
}
示例8: GetCell
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
if (indexPath.Row != 0) {
var cell = tableView.DequeueReusableCell (cellId);
if (cell == null) {
cell = new UITableViewCell (UITableViewCellStyle.Default, cellId);
}
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
cell.TextLabel.Text = items [indexPath.Row - 1].Name;
cell.TextLabel.Font = UIFont.FromName ("Helvetica-Bold", 14f);
cell.TextLabel.TextColor = UIColor.White;
cell.TextLabel.BackgroundColor = UIColor.Clear;
cell.ContentView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("./Assets/cell.png"));
return cell;
}
else {
var cell = tableView.DequeueReusableCell(featuredCellId) as FeaturedCell;
if (cell == null) {
cell = new FeaturedCell (featuredCellId);
}
cell.SetFeaturedCell (featured);
cell.ContentView.BackgroundColor = UIColor.FromRGB (26, 26, 26);
return cell;
}
}
示例9: GetCell
public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell ret;
if (indexPath.Row < 5)
{
ret = tableView.DequeueReusableCell ("RootItem1");
if (ret == null)
{
ret = new UITableViewCell (UITableViewCellStyle.Value1, "RootItem1");
ret.SelectionStyle = UITableViewCellSelectionStyle.None;
}
switch (indexPath.Row)
{
case 0:
ret.TextLabel.Text = "Device Name";
ret.DetailTextLabel.Text = DeviceInfo.CurrentDevice.DeviceName;
break;
case 1:
ret.TextLabel.Text = "OS Name";
ret.DetailTextLabel.Text = DeviceInfo.CurrentDevice.OSName;
break;
case 2:
ret.TextLabel.Text = "OS Version";
ret.DetailTextLabel.Text = DeviceInfo.CurrentDevice.OSVersion;
break;
case 3:
ret.TextLabel.Text = "Model Name";
ret.DetailTextLabel.Text = DeviceInfo.CurrentDevice.ModelName;
break;
case 4:
ret.TextLabel.Text = "Model Id";
ret.DetailTextLabel.Text = DeviceInfo.CurrentDevice.SpecificHWVersion;
break;
case 5:
ret.TextLabel.Text = "Owner Name";
ret.DetailTextLabel.Text = DeviceInfo.CurrentDevice.OwnerName;
break;
default:
break;
}
}
else
{
ret = tableView.DequeueReusableCell ("RootItem2");
if (ret == null)
{
ret = new TextEditCell ("RootItem2");
}
ret.TextLabel.Text = "Owner Name";
((TextEditCell)ret).TextField.Text = DeviceInfo.CurrentDevice.OwnerName;
}
return ret;
}
示例10: GetCell
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
var row = indexPath.Row;
var section = indexPath.Section;
// IF MAP BUTTON
if(datelist.Count() <= section)
{
var mapCell = tableView.DequeueReusableCell("LoggTableCellLast");
if(mapCell == null)
mapCell = new UIJaktTableViewCell(UITableViewCellStyle.Default, "LoggTableCellLast");
mapCell.TextLabel.Text = Utils.Translate("log.showlogsinmap");
mapCell.ImageView.Image = new UIImage("Images/Icons/radar.png");
mapCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
//mapCell.BackgroundColor = UIColor.FromRGB(0.4f, 0.7f, 0.4f);
mapCell.Hidden = _logger.Where(l => l.Latitude != "").Count() == 0;
return mapCell;
}
// ELSE
var cell = tableView.DequeueReusableCell("LoggTableCell");
if(cell == null)
cell = new UIJaktTableViewCell(UITableViewCellStyle.Subtitle, "LoggTableCell");
var currentLogs = _logger.Where(l => l.Dato.ToLocalDateString() == datelist.ElementAt(section));
var logg = currentLogs.ElementAt(row);
cell.TextLabel.Text = logg.Dato.ToLocalTimeString();
var art = JaktLoggApp.instance.GetArt(logg.ArtId);
if(art != null)
cell.DetailTextLabel.Text = logg.Treff + " " + art.Navn + " " + logg.Skudd + " skudd. ";
else if(logg.Skudd > 0)
cell.DetailTextLabel.Text = logg.Skudd + " " + Utils.Translate("shots") + ". " +
logg.Treff + " "+ Utils.Translate("hits") + " ";
else
cell.DetailTextLabel.Text = "";
if(logg.JegerId > 0)
cell.DetailTextLabel.Text += JaktLoggApp.instance.GetJeger(logg.JegerId).Fornavn;
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
var imgstr = Utils.GetPath("jaktlogg_"+logg.ID+".jpg");
if(!File.Exists(imgstr)){
imgstr = "Images/Icons/pictureframe.png";
cell.ImageView.Image = new UIImage(imgstr);
}
else
cell.ImageView.Image = new UIImage(Utils.GetPath(imgstr));
cell.ImageView.Layer.MasksToBounds = true;
cell.ImageView.Layer.CornerRadius = 5.0f;
return cell;
}
示例11: GetCell
public UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
{
var cell = (CustomCell)tableView.DequeueReusableCell ("myCell");
if (cell == null) {
tableView.RegisterNibForCellReuse (UINib.FromName("CustomCell", null), "myCell");
cell = (CustomCell)tableView.DequeueReusableCell ("myCell");
}
return cell;
}
示例12: GetNativeCell
internal static UITableViewCell GetNativeCell(UITableView tableView, Cell cell, bool recycleCells = false, string templateId = "")
{
var id = cell.GetType().FullName;
var renderer = (CellRenderer)Registrar.Registered.GetHandler(cell.GetType());
ContextActionsCell contextCell = null;
UITableViewCell reusableCell = null;
if (cell.HasContextActions || recycleCells)
{
contextCell = (ContextActionsCell)tableView.DequeueReusableCell(ContextActionsCell.Key + templateId);
if (contextCell == null)
{
contextCell = new ContextActionsCell(templateId);
reusableCell = tableView.DequeueReusableCell(id);
}
else
{
contextCell.Close();
reusableCell = contextCell.ContentCell;
if (reusableCell.ReuseIdentifier.ToString() != id)
reusableCell = null;
}
}
else
reusableCell = tableView.DequeueReusableCell(id);
var nativeCell = renderer.GetCell(cell, reusableCell, tableView);
var cellWithContent = nativeCell;
// Sometimes iOS for returns a dequeued cell whose Layer is hidden.
// This prevents it from showing up, so lets turn it back on!
if (cellWithContent.Layer.Hidden)
cellWithContent.Layer.Hidden = false;
if (contextCell != null)
{
contextCell.Update(tableView, cell, nativeCell);
var viewTableCell = contextCell.ContentCell as ViewCellRenderer.ViewTableCell;
if (viewTableCell != null)
viewTableCell.SupressSeparator = true;
nativeCell = contextCell;
}
// Because the layer was hidden we need to layout the cell by hand
if (cellWithContent != null)
cellWithContent.LayoutSubviews();
return nativeCell;
}
示例13: GetCell
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
if(indexPath.Section == 0)
{
//Input-box
var cell = tableView.DequeueReusableCell("FieldStringCell");
if(cell == null){
NSBundle.MainBundle.LoadNib("TextInputCell", controller, null);
cell = controller.Cell;
controller.TextField.BecomeFirstResponder();
controller.TextField.ReturnKeyType = UIReturnKeyType.Done;
controller.TextField.ShouldReturn = SaveText;
controller.TextField.KeyboardType = _tableViewController.KeyboardType;
}
controller.TextField.Text = _tableViewController.Value;
controller.TextField.Placeholder = _tableViewController.Placeholder;
return cell;
}
else
{
//Load autosuggestions
var cell = tableView.DequeueReusableCell("FieldAutoSuggestCell");
if(cell == null)
cell = new UIJaktTableViewCell(UITableViewCellStyle.Value1, "FieldAutoSuggestCell");
var suggestion = AutoSuggestions.ElementAt(indexPath.Row);
cell.TextLabel.Text = suggestion.Name;
cell.DetailTextLabel.Text = suggestion.Count.ToString();
return cell;
}
/*else
{
//Cancel-button
var cell = tableView.DequeueReusableCell("FieldCancelCell");
if(cell == null)
cell = new UIJaktTableViewCell(UITableViewCellStyle.Default, "FieldCancelCell");
cell.TextLabel.Text = Utils.Translate("cancel");
cell.TextLabel.TextAlignment = UITextAlignment.Center;
cell.Hidden = _tableViewController.NavigationController != null;
return cell;
}*/
}
示例14: GetCell
public override UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
{
var item = Data[indexPath.Row];
var cell = (ByInvestmentTableViewCell)tableView.DequeueReusableCell (investmentId);
if (cell == null)
cell = new ByInvestmentTableViewCell (investmentId, sourceNames);
//cell.SeparatorInset = new UIEdgeInsets (0, 0, 0, 10);
cell.FundNameLabel.Text = item.FundName;
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
var x = 0;
foreach (var name in sourceNames) {
cell.SourceAmounts [x].Item1.Text = name;
var amount = 0.00;
if (item.SourceAmounts.ContainsKey (name)) {
amount = item.SourceAmounts [name];
}
cell.SourceAmounts [x].Item2.Text = String.Format ("{0:C}", amount);
x++;
}
return cell;
}
示例15: GetCell
public override UITableViewCell GetCell (UITableView tv)
{
var cell = tv.DequeueReusableCell(CellReuseIdentifier) as OwnerDrawnCell;
if (cell == null)
{
cell = new OwnerDrawnCell(this, Style, CellReuseIdentifier);
OnCreateCell(cell);
}
else
{
cell.Element = this;
}
if (Tapped != null) {
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
}
else
{
cell.Accessory = UITableViewCellAccessory.None;
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
}
cell.BackgroundColor = BackgroundColor;
cell.Update();
return cell;
}