本文整理汇总了C#中UITableViewCell.AddSubviews方法的典型用法代码示例。如果您正苦于以下问题:C# UITableViewCell.AddSubviews方法的具体用法?C# UITableViewCell.AddSubviews怎么用?C# UITableViewCell.AddSubviews使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableViewCell
的用法示例。
在下文中一共展示了UITableViewCell.AddSubviews方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCell
public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
{
if (indexPath.Section == 0) {
var infocell = new UITableViewCell ();
if (controller._controllerMode == 2) {
var inform = AppApi.GetSheets ().DataStudent.First (x => x.Id == editModel.SheetId);
//Customizing the progress bar
float sumWordAnswers = inform.Bad + inform.Good + inform.Nearly + inform.No;
var customProgressBar = UICustomProgressBar.Create ();
customProgressBar.Frame = new System.Drawing.RectangleF (10, 40, UIScreen.MainScreen.Bounds.Width-20, 4);
var width = customProgressBar.Frame.Width;
var height = customProgressBar.Frame.Height;
if (sumWordAnswers != 0) {
var badWidth = (inform.Bad / sumWordAnswers) * width;
var goodWidth = (inform.Good / sumWordAnswers) * width;
var noWidth = (inform.No / sumWordAnswers) * width;
var nearlyWidth = (inform.Nearly / sumWordAnswers) * width;
customProgressBar.ProgressBarRed = new System.Drawing.RectangleF (0, 2, badWidth, height);
customProgressBar.ProgressBarYellow = new System.Drawing.RectangleF (badWidth, 2, nearlyWidth, height);
customProgressBar.ProgressBarGreen = new System.Drawing.RectangleF (badWidth + nearlyWidth, 2, goodWidth, height);
customProgressBar.ProgressBarSilver = new System.Drawing.RectangleF (badWidth + nearlyWidth + goodWidth, 2, noWidth, height);
} else {
customProgressBar.ProgressBarRed = new System.Drawing.RectangleF (0, 0, 0, 0);
customProgressBar.ProgressBarYellow = new System.Drawing.RectangleF (0, 0, 0, 0);
customProgressBar.ProgressBarGreen = new System.Drawing.RectangleF (0, 0, 0, 0);
customProgressBar.ProgressBarSilver = new System.Drawing.RectangleF (0, 0, width, height);
}
infocell.AddSubview (customProgressBar);
} else {
UITextField title = new UITextField (new System.Drawing.RectangleF (15, 35, UIScreen.MainScreen.Bounds.Width - 130, 20));
title.Placeholder = "Введите название";
title.BorderStyle = UITextBorderStyle.RoundedRect;
if (editModel != null)
title.Text = editModel.Name;
UIButton save = new UIButton (new System.Drawing.RectangleF (title.Frame.Right + 5, 35, 100, 20));
save.SetTitle ("Сохранить", UIControlState.Normal);
save.BackgroundColor = UIColor.FromRGB (15, 83, 250);
save.TouchUpInside += (object sender, EventArgs e) => {
};
infocell.AddSubviews (new UIView[]{ title, save });
}
return infocell;
}
var cell = UIWordEdit.Create (); //tableView.DequeueReusableCell (UIWordEdit.Key, indexPath) as UIWordEdit;
// if there are no cells to reuse, create a new one
//if (cell == null)
// cell = new UIListWordCell (UITableViewCellStyle.Default, cellIdentifier);
var oneItem = model.Data [indexPath.Row];
cell.Id = oneItem.Id;
cell.Russian = oneItem.Russian;
cell.Transcr = oneItem.Transcription;
cell.Example = oneItem.Description;
cell.English = oneItem.English;
cell.EditBtmEvent = (object sender, EventArgs e) => {
controller.Edit (model.Data [indexPath.Row]);
};
cell.DelBtmEvent = (object sender, EventArgs e) => {
if (!AppApi.DeleteWord (model.Data [indexPath.Row].Id))
return;
model.Data.RemoveAt (indexPath.Row);
tableView.DeleteRows (new NSIndexPath[]{ indexPath }, UITableViewRowAnimation.Fade);
};
if (controller._controllerMode == 2)
cell.DisableControls = true;
return cell;
}