本文整理汇总了C#中UITableView类的典型用法代码示例。如果您正苦于以下问题:C# UITableView类的具体用法?C# UITableView怎么用?C# UITableView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UITableView类属于命名空间,在下文中一共展示了UITableView类的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: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
var list = new List<NewsModel>();
var table = new UITableView (new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height));
View.Add (table);
try{
var request = WebRequest.Create("http://api.bbcnews.appengine.co.uk/stories/"+_category);
var response = request.GetResponse ();
using(var stream = new StreamReader(response.GetResponseStream())){
var json = stream.ReadToEnd ();
var jsonVal = JsonValue.Parse (json);
for(var i=0; i<jsonVal["stories"].Count; i++){
list.Add (new NewsModel () {
Title = jsonVal["stories"][i]["title"],
Description = jsonVal["stories"][i]["description"],
Thumbnail = jsonVal["stories"][i]["thumbnail"],
Link = jsonVal["stories"][i]["link"]
});
}
};
response.Close ();
}catch{
}
table.Source = new NewsTableSource(list.ToArray(), NavigationController);
// Perform any additional setup after loading the view, typically from a nib.
}
示例3: GetHeightForRow
public override nfloat GetHeightForRow (UITableView tableView, Foundation.NSIndexPath indexPath)
{
if (!data.IsList && indexPath.Section == 0) {
return indexPath.Row == 0 ? 66.0f : 22.0f;
}
return 44.0f;
}
示例4: 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;
}
示例5: 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;
}
示例6: Selected
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
Value = !Value;
InitializeCell(tableView);
base.Selected(dvc, tableView, path);
}
示例7: GetHeightTitle
public float GetHeightTitle(UITableView tableView)
{
var size2 = tableView.StringSize (_post.TitleDecoded, HeadingFont,
new SizeF(tableView.Frame.Width - 24, 60));
return size2.Height + 2;
}
示例8: CommitEditingStyle
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
{
if (editingStyle == UITableViewCellEditingStyle.Delete) {
_taskManager.RemoveItem(_taskManager.TodoItems[indexPath.Row]);
tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Top);
}
}
示例9: GetHeightForHeader
public override float GetHeightForHeader (UITableView tableView, int section)
{
if(section > 0)
return 0.0f;
return 160f;
}
示例10: EditingStyleForRow
public override UITableViewCellEditingStyle EditingStyleForRow (UITableView tableView, NSIndexPath indexPath)
{
var artsInSection = JaktLoggApp.instance.ArtList.Where(a => a.GroupId == 100).Count();
if(indexPath.Section == 0 && indexPath.Row == artsInSection)
return UITableViewCellEditingStyle.Insert;
return UITableViewCellEditingStyle.Delete;
}
示例11: GetCell
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell("ArterTableCell");
if(cell == null)
cell = new UIJaktTableViewCell(UITableViewCellStyle.Default, "ArterTableCell");
var groupId = JaktLoggApp.instance.ArtGroupList[indexPath.Section].ID;
var artsInSection = JaktLoggApp.instance.ArtList.Where(a => a.GroupId == groupId);
var c = artsInSection.Count();
//legg til art - knapp
if(_controller.TableView.Editing && groupId == 100 && indexPath.Row == c){
cell.TextLabel.Text = Utils.Translate("specie.new");
//cell.Accessory = UITableViewCellAccessory.None;
cell.ImageView.Image = null;
}
else
{
var art = artsInSection.ElementAt(indexPath.Row);
var label = art.Navn;
var icon = JaktLoggApp.instance.SelectedArtIds.Contains(art.ID) ? "icon_checked.png" : "icon_unchecked.png";
var file = "Images/Icons/"+icon;
cell.ImageView.Image = new UIImage(file);
cell.ImageView.Layer.MasksToBounds = true;
cell.ImageView.Layer.CornerRadius = 5.0f;
cell.TextLabel.Text = label;
cell.TextLabel.TextAlignment = UITextAlignment.Left;
if(!EditMode)
cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
}
return cell;
}
示例12: GetCell
public override UITableViewCell GetCell (UITableView tv)
{
var cell = base.GetCell (tv);
if (this.IsMandatory)
cell.TextLabel.Text += "*";
return cell;
}
示例13: Selected
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
if (IsReadonly) {
base.Selected (dvc, tableView, path);
return;
}
var controller = new UIViewController ();
UITextView disclaimerView = new UITextView (controller.View.Frame);
// disclaimerView.BackgroundColor = UIColor.FromWhiteAlpha (0, 0);
// disclaimerView.TextColor = UIColor.White;
// disclaimerView.TextAlignment = UITextAlignment.Left;
if (!string.IsNullOrWhiteSpace (Value))
disclaimerView.Text = Value;
else
disclaimerView.Text = string.Empty;
disclaimerView.Font = UIFont.SystemFontOfSize (16f);
disclaimerView.Editable = true;
controller.View.AddSubview (disclaimerView);
controller.NavigationItem.Title = Caption;
controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem (string.IsNullOrEmpty (_saveLabel) ? "Save" : _saveLabel, UIBarButtonItemStyle.Done, (object sender, EventArgs e) => {
if (OnSave != null)
OnSave (this, EventArgs.Empty);
controller.NavigationController.PopViewControllerAnimated (true);
Value = disclaimerView.Text;
});
dvc.ActivateController (controller);
}
示例14: CreateCell
protected override StandardContentCell CreateCell(UITableView tableView)
{
var cell = new StandardContentCell(UITableViewCellStyle.Default, Type);
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
button = UIButton.FromType (UIButtonType.Custom);
button.SetTitle (Text, UIControlState.Normal);
button.Font = UIFont.BoldSystemFontOfSize (16);
button.BackgroundColor = BackgroundColor;
button.TitleEdgeInsets = new UIEdgeInsets(0, 6, 0, 6);
button.Layer.CornerRadius = 7.0f;
button.SetTitleColor(TextColor, UIControlState.Normal);
button.SizeToFit ();
button.TouchUpInside += delegate {
RowSelectedImpl (tableView);
};
if (Disable) {
button.UserInteractionEnabled = false;
button.Enabled = false;
button.TitleLabel.Enabled = false;
}
float left = (tableView.Frame.Width - button.Frame.Width ) / 2 - 12;
button.Frame = new RectangleF(left, 4, button.Frame.Width + 12, 36);
cell.ContentView.Add (button);
return cell;
}
示例15: InitializeCell
public override void InitializeCell(UITableView tableView)
{
Cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
TextLabel.Text = Caption;
base.InitializeCell(tableView);
}