本文整理汇总了C#中UITableViewCell类的典型用法代码示例。如果您正苦于以下问题:C# UITableViewCell类的具体用法?C# UITableViewCell怎么用?C# UITableViewCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UITableViewCell类属于命名空间,在下文中一共展示了UITableViewCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCell
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
// request a recycled cell to save memory
UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
// if there are no cells to reuse, create a new one
if (cell == null)
cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier);
cell.TextLabel.Text = tableItems [indexPath.Row].Name;
cell.TextLabel.TextColor = UIColor.White;
switch (tableItems [indexPath.Row].Type) {
case "Lab":
cell.BackgroundColor = UIColor.FromRGB (158, 30, 98);
break;
case "Utility":
cell.BackgroundColor = UIColor.FromRGB (164, 164, 164);
break;
case "Office":
cell.BackgroundColor = UIColor.FromRGB (11, 39, 63);
break;
case "Toilet":
cell.BackgroundColor = UIColor.FromRGB (191, 185, 73);
break;
case "Stairs":
cell.BackgroundColor = UIColor.FromRGB (208, 74, 45);
break;
}
return cell;
}
示例2: GetCell
/// <summary>
/// Called by the TableView to get the actual UITableViewCell to render for the particular section and row
/// </summary>
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
// declare vars
UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
//string item = tableItems [indexPath.Row]; //.Items[indexPath.Row];
// if there are no cells to reuse, create a new one
if (cell == null)
cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellIdentifier);
// set the item text
cell.TextLabel.Text = tableItems [indexPath.Row];//.Items[indexPath.Row].Heading;
// if it's a cell style that supports a subheading, set it
// if(item.CellStyle == UITableViewCellStyle.Subtitle
// || item.CellStyle == UITableViewCellStyle.Value1
// || item.CellStyle == UITableViewCellStyle.Value2)
// { cell.DetailTextLabel.Text = item.SubHeading; }
// if the item has a valid image, and it's not the contact style (doesn't support images)
// if(!string.IsNullOrEmpty(item.ImageName) && item.CellStyle != UITableViewCellStyle.Value2)
// {
// if(File.Exists(item.ImageName))
// cell.ImageView.Image = UIImage.FromBundle(item.ImageName);
// }
// set the accessory
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
return cell;
}
示例3: GetCell
public override UITableViewCell GetCell(UITableView tv)
{
var cell = tv.DequeueReusableCell (Key);
if (cell == null){
cell = new UITableViewCell (UITableViewCellStyle.Default, Key);
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
cell.Frame = new RectangleF(cell.Frame.X, cell.Frame.Y, tv.Frame.Width, cell.Frame.Height);
} else {
RemoveTag (cell, 1);
}
if (button == null) {
RectangleF frame = cell.Frame;
frame.Inflate(-10, 0);
button = new GlassButton(frame);
button.TouchUpInside += (o, e) => tapped.Invoke();
button.Font = UIFont.BoldSystemFontOfSize (22);
} else {
button.RemoveFromSuperview();
}
button.SetTitle(this.Caption, UIControlState.Normal);
button.SetTitleColor(UIColor.White, UIControlState.Normal);
button.BackgroundColor = UIColor.Clear;
button.HighlightedColor = this.HighlightedColor;
button.NormalColor = this.NormalColor;
button.DisabledColor = this.DisabledColor;
cell.Add(button);
return cell;
}
示例4: GetCell
public override UITableViewCell GetCell (UITableView tv)
{
var cell = tv.DequeueReusableCell (CellKey);
if (cell == null){
cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey);
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
} else
RemoveTag (cell, 1);
SizeF captionSize = new SizeF (0, 0);
if (Caption != null && ShowCaption){
cell.TextLabel.Text = Caption;
captionSize = cell.TextLabel.StringSize (Caption, UIFont.FromName (cell.TextLabel.Font.Name, UIFont.LabelFontSize));
captionSize.Width += 10; // Spacing
}
if (slider == null){
slider = new UISlider (new RectangleF (10f + captionSize.Width, 12f, 280f - captionSize.Width, 7f)){
BackgroundColor = UIColor.Clear,
MinValue = this.MinValue,
MaxValue = this.MaxValue,
Continuous = true,
Value = this.Value,
Tag = 1
};
slider.ValueChanged += delegate {
Value = slider.Value;
};
} else {
slider.Value = Value;
}
cell.ContentView.AddSubview (slider);
return cell;
}
示例5: GetCell
/// <summary>
/// Called by the TableView to get the actual UITableViewCell to render for the particular row
/// </summary>
public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
{
// request a recycled cell to save memory
UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
// UNCOMMENT one of these to use that style
var cellStyle = UITableViewCellStyle.Default;
// var cellStyle = UITableViewCellStyle.Subtitle;
// var cellStyle = UITableViewCellStyle.Value1;
// var cellStyle = UITableViewCellStyle.Value2;
// if there are no cells to reuse, create a new one
if (cell == null) {
cell = new UITableViewCell (cellStyle, cellIdentifier);
}
cell.TextLabel.Text = tableItems[indexPath.Row].Heading;
// Default style doesn't support Subtitle
if (cellStyle == UITableViewCellStyle.Subtitle
|| cellStyle == UITableViewCellStyle.Value1
|| cellStyle == UITableViewCellStyle.Value2) {
cell.DetailTextLabel.Text = tableItems[indexPath.Row].SubHeading;
}
// Value2 style doesn't support an image
if (cellStyle != UITableViewCellStyle.Value2)
cell.ImageView.Image = UIImage.FromFile ("Images/" +tableItems[indexPath.Row].ImageName);
return cell;
}
示例6: GetCell
public override UITableViewCell GetCell(UITableView tv)
{
var cell = tv.DequeueReusableCell(CellKey);
if (cell == null)
{
cell = new UITableViewCell(UITableViewCellStyle.Default, CellKey);
if ((Flags & CellFlags.Transparent) != 0)
{
cell.BackgroundColor = UIColor.Clear;
//
// This trick is necessary to keep the background clear, otherwise
// it gets painted as black
//
cell.BackgroundView = new UIView(RectangleF.Empty)
{
BackgroundColor = UIColor.Clear
};
}
if ((Flags & CellFlags.DisableSelection) != 0)
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
if (Caption != null)
cell.TextLabel.Text = Caption;
cell.ContentView.AddSubview(View);
}
return cell;
}
示例7: GetCell
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = new UITableViewCell();
var item = data[indexPath.Row];
cell.TextLabel.Text = (item as SampleModel).Name;
return cell;
}
示例8: GetCell
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell,
UITableView tv)
{
var cell = base.GetCell(item, reusableCell, tv);
switch (item.StyleId)
{
case "none":
cell.Accessory = UITableViewCellAccessory.None;
break;
case "checkmark":
cell.Accessory = UITableViewCellAccessory.Checkmark;
break;
case "detail-button":
cell.Accessory = UITableViewCellAccessory.DetailButton;
break;
case "detail-disclosure-button":
cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
break;
case "disclosure":
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
break;
default:
cell.Accessory = UITableViewCellAccessory.None;
break;
}
return cell;
}
示例9: GetCell
/// <summary>
/// Called by the TableView to get the actual UITableViewCell to render for the particular row
/// </summary>
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
// request a recycled cell to save memory
UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
// TODO: UNCOMMENT one of these to use that style
var cellStyle = UITableViewCellStyle.Default;
//var cellStyle = UITableViewCellStyle.Subtitle;
//var cellStyle = UITableViewCellStyle.Value1;
//var cellStyle = UITableViewCellStyle.Value2;
// if there are no cells to reuse, create a new one
if (cell == null) {
cell = new UITableViewCell (cellStyle, cellIdentifier);
}
cell.TextLabel.Text = tableItems[indexPath.Row].Heading;
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
cell.ImageView.Image= UIImage.FromFile ("Images/" +tableItems[indexPath.Row].ImageName);
// Default style doesn't support Subtitle
// if (cellStyle == UITableViewCellStyle.Subtitle
// || cellStyle == UITableViewCellStyle.Value1
// || cellStyle == UITableViewCellStyle.Value2) {
// cell.DetailTextLabel.Text = tableItems[indexPath.Row].SubHeading;
// }
// Value2 style doesn't support an image
if (cellStyle != UITableViewCellStyle.Value2)
cell.ImageView.Image = UIImage.FromFile ("Images/" +tableItems[indexPath.Row].ImageName);
//FitpulseTheme.Apply (cell);
return cell;
}
示例10: GetCell
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var textCell = (TextCell)item;
var tvc = reusableCell as CellTableViewCell;
if (tvc == null)
tvc = new CellTableViewCell(UITableViewCellStyle.Subtitle, item.GetType().FullName);
else
tvc.Cell.PropertyChanged -= tvc.HandlePropertyChanged;
tvc.Cell = textCell;
textCell.PropertyChanged += tvc.HandlePropertyChanged;
tvc.PropertyChanged = HandlePropertyChanged;
tvc.TextLabel.Text = textCell.Text;
tvc.DetailTextLabel.Text = textCell.Detail;
tvc.TextLabel.TextColor = textCell.TextColor.ToUIColor(DefaultTextColor);
tvc.DetailTextLabel.TextColor = textCell.DetailColor.ToUIColor(DefaultDetailColor);
WireUpForceUpdateSizeRequested(item, tvc, tv);
UpdateIsEnabled(tvc, textCell);
UpdateBackground(tvc, item);
return tvc;
}
示例11: GetCell
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = tableView.DequeueReusableCell(kCellIdentifier);
if(cell == null)
{
cell = new UITableViewCell(UITableViewCellStyle.Value1, kCellIdentifier);
}
int minutes = (list[indexPath.Row].arrivalTime.Subtract(DateTime.Now)).Minutes;
string label = list[indexPath.Row].route.routeName + " " + list[indexPath.Row].destination.stationName;
if(list[indexPath.Row].isApproaching) {
label += " (A)";
} else if(list[indexPath.Row].isDelayed) {
label += " (D)";
}
cell.TextLabel.Text = label;
cell.DetailTextLabel.Text = (minutes == 0) ? "Due" : (minutes + " " + (minutes > 1 ? "mins" : "min"));
return cell;
}
示例12: WillDisplay
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
{
if (indexPath.Row == Entries.Count - 1) {
GenerateEntries (25);
tableView.ReloadData ();
}
}
示例13: GetCell
public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath)
{
var tableCell = tableView.DequeueReusableCell (cellId);
if (tableCell == null) {
tableCell = new UITableViewCell (
UITableViewCellStyle.Subtitle,
cellId
);
tableCell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
if (tableCell.TextLabel != null) {
tableCell.TextLabel.TextColor = UIColor.White;
}
tableCell.BackgroundColor = UIColor.FromRGB (9, 34, 65);
var backgroundView = new UIView ();
backgroundView.BackgroundColor = UIColor.FromRGB (88, 181, 222);
tableCell.SelectedBackgroundView = backgroundView;
tableCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
tableCell.TintColor = UIColor.White;
}
var entry = Entries [indexPath.Row];
tableCell.TextLabel.Text = entry;
return tableCell;
}
示例14: GetCell
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var obj = base.GetCell(item, reusableCell, tv);
var cellEx = item as TextCellEx;
if (!cellEx.IsShow)
{
obj.Accessory = UITableViewCellAccessory.None;
}
else
{
switch (cellEx.ShowIndicator)
{
case RightIndicator.Entry:
obj.Accessory = UITableViewCellAccessory.DisclosureIndicator;
break;
case RightIndicator.Check:
obj.Accessory = UITableViewCellAccessory.Checkmark;
break;
case RightIndicator.None:
obj.Accessory = UITableViewCellAccessory.None;
break;
}
}
return obj;
}
示例15: GetCell
public override UITableViewCell GetCell(UITableView tv)
{
var cell = tv.DequeueReusableCell (cpkey);
if (cell == null){
cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cpkey);
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
} else
RemoveTag (cell, 1);
if (control == null)
{
if (colorSelections != null)
{
control = new SegmentControl(colorSelections);
control.ColorSelected += delegate(UIColor selectedColor, UIColor previousColor) {
if (ColorSelected != null) ColorSelected(selectedColor);
};
}
else if (unselectedImages != null)
{
control = new SegmentControl(unselectedImages, selectedImages);
control.ImageSelected += delegate(int imageIndex) {
if (ImageSelected != null) ImageSelected(imageIndex);
};
}
}
else control.SetNeedsDisplay();
cell.AccessoryView = control;
cell.TextLabel.Text = Caption;
return cell;
}