// // Computes the X position for the entry by aligning all the entries in the Section // SizeF ComputeEntryPosition (UITableView tv, UITableViewCell cell) { Section s = Parent as Section; if (s.EntryAlignment.Width != 0) return s.EntryAlignment; SizeF max = new SizeF (-1, -1); foreach (var e in s.Elements){ var ee = e as MultilineEntryElement; if (ee == null) continue; SizeF size = new SizeF(0,0); if (!string.IsNullOrEmpty(ee.Caption)) { size = tv.StringSize (ee.Caption, font); } else { var useHeight = tv.StringSize (" ", font); size = new SizeF(0, useHeight.Height); } if (size.Width > max.Width) max = size; } if (max.Width > 0) { s.EntryAlignment = new SizeF (25 + Math.Min (max.Width, 160), max.Height); } else { s.EntryAlignment = new SizeF(2, max.Height); } return s.EntryAlignment; }
public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor) : base ("") { this.NormalCaption = normalCaption; this.LoadingCaption = loadingCaption; this.tapped = tapped; this.font = font; cell = new UITableViewCell (UITableViewCellStyle.Default, "loadMoreElement"); activityIndicator = new UIActivityIndicatorView () { ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray, Hidden = true }; activityIndicator.StopAnimating (); caption = new UILabel () { Font = font, Text = this.NormalCaption, TextColor = textColor, BackgroundColor = UIColor.Clear, TextAlignment = UITextAlignment.Center, AdjustsFontSizeToFitWidth = false, }; Layout (); cell.ContentView.AddSubview (caption); cell.ContentView.AddSubview (activityIndicator); }
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv) { var entryCell = (EntryCell)item; var tvc = reusableCell as EntryCellTableViewCell; if (tvc == null) tvc = new EntryCellTableViewCell(item.GetType().FullName); else { tvc.Cell.PropertyChanged -= OnCellPropertyChanged; tvc.TextFieldTextChanged -= OnTextFieldTextChanged; tvc.KeyboardDoneButtonPressed -= OnKeyBoardDoneButtonPressed; } SetRealCell(item, tvc); tvc.Cell = item; tvc.Cell.PropertyChanged += OnCellPropertyChanged; tvc.TextFieldTextChanged += OnTextFieldTextChanged; tvc.KeyboardDoneButtonPressed += OnKeyBoardDoneButtonPressed; WireUpForceUpdateSizeRequested(item, tvc, tv); UpdateBackground(tvc, entryCell); UpdateLabel(tvc, entryCell); UpdateText(tvc, entryCell); UpdateKeyboard(tvc, entryCell); UpdatePlaceholder(tvc, entryCell); UpdateLabelColor(tvc, entryCell); UpdateHorizontalTextAlignment(tvc, entryCell); UpdateIsEnabled(tvc, entryCell); return tvc; }
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; }
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; }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(ckey); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Subtitle, ckey); cell.SelectionStyle = UITableViewCellSelectionStyle.Blue; cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; } cell.TextLabel.Text = detailImageData.Title; cell.DetailTextLabel.Text = detailImageData.SubTitle; cell.DetailTextLabel.LineBreakMode = UILineBreakMode.WordWrap; cell.DetailTextLabel.Lines = 2; // to show an image on the right instead of the left. Just set the accessory view to that of a UIImageView. if (cell.AccessoryView == null) { var img = ImageLoader.DefaultRequestImage(detailImageData.ImageUri, this); if (img != null) { var imgView = new UIImageView(img); imgView.Frame = new RectangleF(0,0,75,65); cell.AccessoryView = imgView; } } return cell; }
/// <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; }
/// <summary> /// Gets 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); TableItem item = indexedTableItems[keys[indexPath.Section]][indexPath.Row]; if (cell == null) { // use a Subtitle cell style here cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellIdentifier); } //---- set the item text, subtitle and image/icon cell.TextLabel.Text = item.Heading; cell.DetailTextLabel.Text = item.Album; cell.ImageView.Image = UIImage.FromFile("Images/" + item.ImageName); // if the item is marked as a favorite, use the CheckMark cell accessory // otherwise (i.e. when false) use the disclosure cell accessory if (item.Singing) { cell.Accessory = UITableViewCellAccessory.Checkmark; } else { cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; } return cell; }
/// <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; }
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; }
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; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = new UITableViewCell (UITableViewCellStyle.Default, "PhotoCell"); cell.ImageView.SetImage (new NSUrl (PhotoCells [indexPath.Row].thumbnailUrl), UIImage.FromBundle ("git")); cell.TextLabel.Text = PhotoCells [indexPath.Row].title; return cell; }
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; }
/// <summary> /// Called by the TableView to actually build each cell. /// </summary> public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { // declare vars NavItem navItem = navItems[indexPath.Section].Items[indexPath.Row]; UIImage navIcon = null; var cell = tableView.DequeueReusableCell (cellIdentifier); if (cell == null) { cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier); cell.Tag = Environment.TickCount; } // set the cell properties cell.TextLabel.Text = navItems[indexPath.Section].Items[indexPath.Row].Name; cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; // if (!String.IsNullOrEmpty (navItem.ImagePath)) // { // navIcon = UIImage.FromFile (navItem.ImagePath); // if (navIcon != null) // { // navTableCellView.IconImage = navIcon; // } // } // return the cell return cell; }
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; }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell (speakerCellId); // TODO: Step 4e: change the UITableViewCellStyle according to the lab instructions // Uncomment only one of the built-in UITableViewCellStyles if (cell == null) { // cell = new UITableViewCell (UITableViewCellStyle.Default, speakerCellId); cell = new UITableViewCell (UITableViewCellStyle.Subtitle, speakerCellId); // cell = new UITableViewCell (UITableViewCellStyle.Value1, speakerCellId); // cell = new UITableViewCell (UITableViewCellStyle.Value2, speakerCellId); } var speaker = data [indexPath.Row]; // ***** Built-in layout elements ***** cell.TextLabel.Text = speaker.Name; // TODO: Step 4a: uncomment to set the cell's DetailTextLabel cell.DetailTextLabel.Text = speaker.Company; // Comment out for UITableViewCellStyle.Default // TODO: Step 4b: uncomment to set the cell's ImageView cell.ImageView.Image = UIImage.FromBundle(speaker.HeadshotUrl); // Comment out for UITableViewCellStyle.Value2 // ***** Built-in cell accessories ***** // TODO: Step 4c: change the cell's Accessory according to the lab instructions // cell.Accessory = UITableViewCellAccessory.Checkmark; // cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; // cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton; // allows you to wire up another 'tap' event return cell; }
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; }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { if (indexPath.Section == 0) return base.GetCell(tableView, indexPath); var cell = new UITableViewCell(UITableViewCellStyle.Default, string.Format("RadioButtonTableCell{0}{1}", indexPath.Section, indexPath.Row)) { AccessoryView = null }; if (IsNumberOfCommitters(indexPath.Section)) { if (indexPath.Row == countSelected) cell.AccessoryView = RadioGroupTableViewSource.BlackAccessoryCheckmark(); cell.TextLabel.Text = string.Format("Top {0} committers", countValues[indexPath.Row]); countCells.Insert(indexPath.Row, cell); } if (IsTimePeriod(indexPath.Section)) { if (indexPath.Row == timeSelected) cell.AccessoryView = RadioGroupTableViewSource.BlackAccessoryCheckmark(); cell.TextLabel.Text = string.Format("Past {0}", timeValues[indexPath.Row].ToSuffix()); timeCells.Insert(indexPath.Row, cell); } cell.StyleAsSettingsTableCell(); return cell; }
public override UITableViewCell GetCell (UITableView tv) { if (sw == null){ sw = new UISwitch (){ BackgroundColor = UIColor.Clear, Tag = 1, On = Value }; sw.AddTarget (delegate { Value = sw.On; }, UIControlEvent.ValueChanged); } else sw.On = Value; var cell = tv.DequeueReusableCell (CellKey); if (cell == null){ cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey); cell.SelectionStyle = UITableViewCellSelectionStyle.None; } else RemoveTag (cell, 1); cell.TextLabel.Text = Caption; cell.AccessoryView = sw; return cell; }
async public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) { if (cell.RespondsToSelector(new ObjCRuntime.Selector("setSeparatorInset:"))) { cell.SeparatorInset = UIEdgeInsets.Zero; } if (cell.RespondsToSelector(new ObjCRuntime.Selector("setPreservesSuperviewLayoutMargins:"))) { cell.PreservesSuperviewLayoutMargins = false; } if (cell.RespondsToSelector(new ObjCRuntime.Selector("setLayoutMargins:"))) { cell.LayoutMargins = UIEdgeInsets.Zero; } if (Master.TailFetchingEnabled && indexPath.Row == Master.GetTableItemCount() - 1 && !Master.Fetching && Master.GetTableItemCount() > 0 && Master.NextAllowedTailFetch < DateTime.UtcNow) { UIView FooterLoadingView = new UIView(new CoreGraphics.CGRect(0, 0, UIScreen.MainScreen.Bounds.Size.Width, ((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController.TabBar.Frame.Size.Height + 60)); UIActivityIndicatorView ai = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray); ai.Frame = new CoreGraphics.CGRect(UIScreen.MainScreen.Bounds.Size.Width / 2 - 15, 15, 30, 30); ai.StartAnimating(); FooterLoadingView.AddSubview(ai); tableView.TableFooterView = FooterLoadingView; Master.Offset = Master.GetTableItemCount();//Master.Offset + Master.Count; await Master.FetchTableData(); } }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell(kCellID); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Value1, kCellID); } UIImageView background = new UIImageView(new RectangleF(0,0,320,44)); background.Image = UIImage.FromFile("Images/cell_background.png"); background.Image.StretchableImage(0,0); cell.BackgroundView = background; UIImageView selectedBackground = new UIImageView(new RectangleF(0,0,320,44)); selectedBackground.Image = UIImage.FromFile("Images/cell_selected_background.png"); selectedBackground.Image.StretchableImage(0,0); cell.SelectedBackgroundView = selectedBackground; cell.TextLabel.TextColor = UIColor.FromRGBA(190f/255f,197f/255f,212f/255f,1f); cell.TextLabel.HighlightedTextColor = cell.TextLabel.TextColor; cell.TextLabel.ShadowColor = UIColor.FromRGBA(33f/255f,38f/255f,49f/255f,1f); cell.TextLabel.ShadowOffset = new SizeF(0f,1f); cell.TextLabel.BackgroundColor = UIColor.Clear; cell.TextLabel.Font = UIFont.FromName("Helvetica", 16f); cell.ImageView.Image = UIImage.FromFile(ImageNames[indexPath.Row]); cell.ImageView.ClipsToBounds = true; cell.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit; cell.TextLabel.Text = MenuOptions[indexPath.Row]; return cell; }
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; }
public override void ViewDidLoad() { base.ViewDidLoad(); View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _pageTransitionStyleCell = createPageTransitionStyleCell(); _pageNavigationOrientationCell = createPageNavigationOrientationCell(); _autoScaleMode = createAutoScaleModeCell(); _topToolbarVisibilityCell = createTopToolbarVisibilityCell(); _bottomToolbarVisibilityCell = createBottomBarVisibilityCell(); _zoomScaleLevelsCell = createZoomScaleLevelsCell(); _zoomByDoubleTouchCell = createmZoomByDoubleTouchCell(); _libraryReleaseDateCell = createLibraryReleaseDateCell(); _libraryVersionCell = createLibraryVersionCell(); TableView = new UITableView(View.Bounds, UITableViewStyle.Grouped) { BackgroundView = null, AutoresizingMask = UIViewAutoresizing.All, Source = new DataSource(this) }; }
/// <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; }
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; }
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) { if (indexPath.Row == Entries.Count - 1) { GenerateEntries (25); tableView.ReloadData (); } }
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; }
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; }
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; }
// Get the cell and add the disclosure indicator if the bindable property was set to true. public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv) { var cell = base.GetCell (item, reusableCell, tv); if( ( (DisclosureImageCell) item ).DisclosureEnabled) cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; return cell; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var section = indexPath.Section; if (section == 0) { var cell = tableView.DequeueReusableCell("N"); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "N"); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.ImageView.Layer.CornerRadius = 6; cell.ImageView.Layer.MasksToBounds = true; } var person = controller.personViewModel.Person; cell.TextLabel.Text = person.SafeDisplayName; if (person.HasEmail) { var imageUrl = Gravatar.GetImageUrl(controller.personViewModel.Person.Email, ImageSize); if (imageDownloader.HasLocallyCachedCopy(imageUrl)) { cell.ImageView.Image = (UIImage)imageDownloader.GetImageAsync(imageUrl).Result; } else { cell.ImageView.Image = PlaceholderImage.Value; imageDownloader.GetImageAsync(imageUrl).ContinueWith(t => { cell.ImageView.Image = (UIImage)t.Result; }, TaskScheduler.FromCurrentSynchronizationContext()); } } return(cell); } else if (section == 1) { var cell = tableView.DequeueReusableCell("F"); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "F"); cell.TextLabel.TextColor = ValueColor; } cell.TextLabel.Text = "Favorite"; cell.Accessory = controller.personViewModel.IsFavorite ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; return(cell); } else { var cell = tableView.DequeueReusableCell("C"); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Value2, "C"); } var prop = controller.personViewModel.PropertyGroups [section - 2].Properties [indexPath.Row]; cell.TextLabel.Text = prop.Name.ToLowerInvariant(); cell.DetailTextLabel.Text = prop.Value; cell.SelectionStyle = prop.Type == PersonViewModel.PropertyType.Generic ? UITableViewCellSelectionStyle.None : UITableViewCellSelectionStyle.Blue; return(cell); } }
public static void AddSeparatorAndSelectionIfNeeded(UITableView tableView, NSIndexPath indexPath, UITableViewCell cell, bool addSeparator, bool addSelection, nfloat height) { if (addSeparator) { AddSeparatorImageAtYPosition(cell, 2f); } if (addSelection) { AddSelection(tableView, indexPath, cell, height); } }
private void ClearBackground(UITableViewCell cell) { cell.BackgroundColor = UIColor.White; cell.TextLabel.BackgroundColor = UIColor.Clear; }
private void PrepareCell(UITableViewCell cell) { if (cell == null) { return; } cell.Accessory = Accessory; var tl = cell.TextLabel; tl.Text = Caption; tl.TextAlignment = Alignment; tl.TextColor = TextColor ?? UIColor.Black; tl.Font = Font ?? UIFont.BoldSystemFontOfSize(17); tl.LineBreakMode = LineBreakMode; tl.Lines = Lines; // The check is needed because the cell might have been recycled. if (cell.DetailTextLabel != null) { cell.DetailTextLabel.Text = Value == null ? "" : Value; } if (_extraInfo == null) { ClearBackground(cell); } else { var imgView = cell.ImageView; UIImage img; if (imgView != null) { if (_extraInfo.Uri != null) { img = ImageLoader.DefaultRequestImage(_extraInfo.Uri, this); } else if (_extraInfo.Image != null) { img = _extraInfo.Image; } else { img = null; } imgView.Image = img; } if (cell.DetailTextLabel != null) { cell.DetailTextLabel.TextColor = _extraInfo.DetailColor ?? UIColor.Gray; } } if (cell.DetailTextLabel != null) { cell.DetailTextLabel.Lines = Lines; cell.DetailTextLabel.LineBreakMode = LineBreakMode; cell.DetailTextLabel.Font = SubtitleFont ?? UIFont.SystemFontOfSize(14); cell.DetailTextLabel.TextColor = (_extraInfo == null || _extraInfo.DetailColor == null) ? UIColor.Gray : _extraInfo.DetailColor; } }
protected override void UpdateCaptionDisplay(UITableViewCell cell) { // note that we deliberately do not call the base class here PrepareCell(cell); }
public virtual void SetBackgroundColor(UITableViewCell tableViewCell, Cell cell, UIColor color) { tableViewCell.TextLabel.BackgroundColor = color; tableViewCell.ContentView.BackgroundColor = color; tableViewCell.BackgroundColor = color; }
internal static void SetRealCell(BindableObject cell, UITableViewCell renderer) { cell.SetValue(RealCellProperty, renderer); }
private void initialize() { //Make new tableview and do some settings AutoCompleteTableView = new UITableView(); AutoCompleteTableView.Layer.CornerRadius = 5; //rounded corners AutoCompleteTableView.ContentInset = UIEdgeInsets.Zero; AutoCompleteTableView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; //for resizing (switching from table to portait for example) AutoCompleteTableView.Bounces = false; AutoCompleteTableView.BackgroundColor = UIColor.Clear; AutoCompleteTableView.TranslatesAutoresizingMaskIntoConstraints = false; AutoCompleteTableView.Source = this.AutoCompleteViewSource; AutoCompleteTableView.TableFooterView = new UIView(); AutoCompleteTableView.Hidden = true; //Some textfield settings this.TranslatesAutoresizingMaskIntoConstraints = false; this.Delegate = this; this.AutocorrectionType = UITextAutocorrectionType.No; this.ClearButtonMode = UITextFieldViewMode.WhileEditing; var isTableViewController = _parentTableViewController ?? (_parentViewController as UITableViewController); //if parent is tableviewcontroller if (isTableViewController != null) { _parentIsUITableViewController = true; if (_parentTableViewController == null) { _parentTableViewController = isTableViewController; } _parentTableViewBounces = _parentTableViewController.TableView.Bounces; _parentTableViewAllowsSelection = _parentTableViewController.TableView.AllowsSelection; //Add the view to the contentview of the cell Superview.AddSubview(AutoCompleteTableView); UITableViewCell cell = Superview.Superview as UIKit.UITableViewCell; //Get indexpath to set the constraint to the right cell NSIndexPath indexPath = _parentTableViewController.TableView.IndexPathForCell(cell); if (indexPath == null) { Console.WriteLine("Should be initialized in the ViewDidAppear and not in the ViewDidLoad!"); return; } //add constraints Superview.AddConstraints( AutoCompleteTableView.WithSameCenterY(this).Plus((AutocompleteTableViewHeight / 2) + 10 + cell.Frame.Height * indexPath.Row), AutoCompleteTableView.WithSameWidth(this), AutoCompleteTableView.WithSameLeft(this), AutoCompleteTableView.Height().EqualTo(AutocompleteTableViewHeight) ); } else { Superview.InsertSubviewBelow(AutoCompleteTableView, _parentViewController.View); //add constraints Superview.AddConstraints( AutoCompleteTableView.AtTopOf(this, this.Frame.Height - 5), AutoCompleteTableView.WithSameWidth(this), AutoCompleteTableView.WithSameLeft(this), AutoCompleteTableView.Height().EqualTo(AutocompleteTableViewHeight) ); } //listen to edit events this.EditingChanged += async(sender, eventargs) => { if (this.Text.Length > StartAutoCompleteAfterTicks) { showAutoCompleteView(); await UpdateTableViewData(); } }; this.EditingDidEnd += (sender, eventargs) => { hideAutoCompleteView(); }; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell(CellIdentifier); var payload = Payloads[indexPath.Row]; //---- if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier); } switch (payload.TypeNameFormat) { case NFCTypeNameFormat.NFCWellKnown: var type = new NSString(payload.Type, NSStringEncoding.UTF8); if (type != null) { cell.TextLabel.Text = $"NFC Well Known type: {type}"; } else { cell.TextLabel.Text = "Invalid data"; } break; case NFCTypeNameFormat.AbsoluteUri: var text = new NSString(payload.Payload, NSStringEncoding.UTF8); if (text != null) { cell.TextLabel.Text = text; } else { cell.TextLabel.Text = "Invalid data"; } break; case NFCTypeNameFormat.Media: var mediaType = new NSString(payload.Type, NSStringEncoding.UTF8); if (mediaType != null) { cell.TextLabel.Text = $"Media type: {mediaType}"; } else { cell.TextLabel.Text = "Invalid data"; } break; case NFCTypeNameFormat.NFCExternal: cell.TextLabel.Text = "NFC External type"; break; case NFCTypeNameFormat.Unknown: cell.TextLabel.Text = "Unknown type"; break; case NFCTypeNameFormat.Unchanged: cell.TextLabel.Text = "Unchanged type"; break; default: cell.TextLabel.Text = "Invalid data"; break; } return(cell); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { //check if the table data has changed before redrawing the table cells UITableViewCell BusinessCell = tableView.DequeueReusableCell(this.transportString); if (BusinessCell == null) { BusinessCell = new UITableViewCell(UITableViewCellStyle.Subtitle, this.transportString); } this.application.cellTransport = BusinessCell; this.favouritesIndicator = new UILabel(); this.favouritesIndicator.Text = "\ud83d\udc9d"; //this.favouritesIndicator.Text = "⭐"; this.favouritesIndicator.MinimumFontSize = 24.0f; this.favouritesIndicator.AdjustsFontSizeToFitWidth = true; this.favouritesIndicator.Frame = new CoreGraphics.CGRect(0, 20, 40, 40); BusinessCell.TextLabel.Text = this.transportDict[indexPath.Row]; BusinessCell.DetailTextLabel.Text = this.transportTranslatedDict[indexPath.Row]; BusinessCell.DetailTextLabel.TextColor = UIColor.Gray; BusinessCell.DetailTextLabel.Font = UIFont.SystemFontOfSize(12.5f); if (BusinessCell.EditingStyle == UITableViewCellEditingStyle.Insert) { this.application.cellTransport.AccessoryView = null; this.application.cellTransport.EditingAccessoryView = null; } if (this.application.localizedTransport.Count == 0) { this.application.cellTransport.AccessoryView = null; this.application.cellTransport.EditingAccessoryView = null; } else if (this.application.localizedTransport.Count >= 1) { if (this.application.localizedTransport.Count == 1) { if (this.application.tabBarID == 1) { BusinessCell.AccessoryView = this.favouritesIndicator; BusinessCell.EditingAccessoryView = this.favouritesIndicator; } else { BusinessCell.AccessoryView = this.favouritesIndicator; BusinessCell.EditingAccessoryView = this.favouritesIndicator; } } //try this code first if (indexPath.Row == this.application.indexTableTransport.Row) { Console.WriteLine("index chosen"); BusinessCell.AccessoryView = this.favouritesIndicator; BusinessCell.EditingAccessoryView = this.favouritesIndicator; } else if (this.application.indexIntTransport.Contains(indexPath.Row) == false) { Console.WriteLine("Index is not found"); BusinessCell.AccessoryView = null; BusinessCell.EditingAccessoryView = null; } else if (this.application.indexIntTransport.Contains(indexPath.Row) == true) { Console.WriteLine("Index table chosen _ 1"); if (indexPath.Row != this.application.indexTableTransport.Row) { Console.WriteLine("Index table chosen _ 2"); BusinessCell.AccessoryView = this.favouritesIndicator; BusinessCell.EditingAccessoryView = this.favouritesIndicator; } } //the previously listed indices have accessory views labelled //this takes the final index path instead of a range /* if (indexPath.Row == this.application.indexInt.Find((int obj) => obj >= indexPath.Row)) { * Console.WriteLine("wtf?"); * BusinessCell.AccessoryView = this.favouritesIndicator; * }*/ //try this code. Using logic operators /*if(this.application.indexTableFavourite.Row == 0 || this.application.indexTableFavourite.Row == 1) { * BusinessCell.AccessoryView = this.favouritesIndicator; * return BusinessCell; * } * else { * BusinessCell.AccessoryView = null; * return BusinessCell; * }*/ return(BusinessCell); } return(BusinessCell); }
public void Update(UITableView tableView, Cell cell, UITableViewCell nativeCell) { var parentListView = cell.RealParent as ListView; var recycling = parentListView != null && ((parentListView.CachingStrategy & ListViewCachingStrategy.RecycleElement) != 0); if (_cell != cell && recycling) { if (_cell != null) { ((INotifyCollectionChanged)_cell.ContextActions).CollectionChanged -= OnContextItemsChanged; } ((INotifyCollectionChanged)cell.ContextActions).CollectionChanged += OnContextItemsChanged; } var height = Frame.Height + (parentListView != null && parentListView.SeparatorVisibility == SeparatorVisibility.None ? 0.5f : 0f); var width = ContentView.Frame.Width; nativeCell.Frame = new RectangleF(0, 0, width, height); nativeCell.SetNeedsLayout(); var handler = new PropertyChangedEventHandler(OnMenuItemPropertyChanged); _tableView = tableView; if (_cell != null) { if (!recycling) { _cell.PropertyChanged -= OnCellPropertyChanged; } if (_menuItems.Count > 0) { if (!recycling) { ((INotifyCollectionChanged)_cell.ContextActions).CollectionChanged -= OnContextItemsChanged; } foreach (var item in _menuItems) { item.PropertyChanged -= handler; } } _menuItems.Clear(); } _menuItems.AddRange(cell.ContextActions); _cell = cell; if (!recycling) { cell.PropertyChanged += OnCellPropertyChanged; ((INotifyCollectionChanged)_cell.ContextActions).CollectionChanged += OnContextItemsChanged; } var isOpen = false; if (_scroller == null) { _scroller = new UIScrollView(new RectangleF(0, 0, width, height)); _scroller.ScrollsToTop = false; _scroller.ShowsHorizontalScrollIndicator = false; _scroller.PreservesSuperviewLayoutMargins = true; ContentView.AddSubview(_scroller); } else { _scroller.Frame = new RectangleF(0, 0, width, height); isOpen = ScrollDelegate.IsOpen; for (var i = 0; i < _buttons.Count; i++) { var b = _buttons[i]; b.RemoveFromSuperview(); b.Dispose(); } _buttons.Clear(); ScrollDelegate.Unhook(_scroller); ScrollDelegate.Dispose(); } if (ContentCell != nativeCell) { if (ContentCell != null) { ContentCell.RemoveFromSuperview(); ContentCell = null; } ContentCell = nativeCell; //Hack: if we have a ImageCell the insets are slightly different, //the inset numbers user below were taken using the Reveal app from the default cells if ((ContentCell as CellTableViewCell)?.Cell is ImageCell) { nfloat imageCellInsetLeft = 57; nfloat imageCellInsetRight = 0; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { imageCellInsetLeft = 89; imageCellInsetRight = imageCellInsetLeft / 2; } SeparatorInset = new UIEdgeInsets(0, imageCellInsetLeft, 0, imageCellInsetRight); } _scroller.AddSubview(nativeCell); } SetupButtons(width, height); UIView container = null; var totalWidth = width; for (var i = _buttons.Count - 1; i >= 0; i--) { var b = _buttons[i]; totalWidth += b.Frame.Width; _scroller.AddSubview(b); } _scroller.Delegate = new ContextScrollViewDelegate(container, _buttons, isOpen); _scroller.ContentSize = new SizeF(totalWidth, height); if (isOpen) { _scroller.SetContentOffset(new PointF(ScrollDelegate.ButtonsWidth, 0), false); } else { _scroller.SetContentOffset(new PointF(0, 0), false); } if (ContentCell != null) { SelectionStyle = ContentCell.SelectionStyle; } }
public TableSource() { expenseViewModel = ServiceContainer.Resolve <ExpenseViewModel>(); categoryCell = new UITableViewCell(UITableViewCellStyle.Default, null); categoryCell.TextLabel.Text = "Category"; categoryCell.SelectionStyle = UITableViewCellSelectionStyle.None; categoryCell.AccessoryView = category = new UILabel(new CGRect(0f, 0f, 200f, 36f)) { TextAlignment = UITextAlignment.Right, BackgroundColor = UIColor.Clear, }; costCell = new UITableViewCell(UITableViewCellStyle.Default, null); costCell.TextLabel.Text = "Cost"; costCell.SelectionStyle = UITableViewCellSelectionStyle.None; costCell.AccessoryView = cost = new UITextField(new CGRect(0f, 0f, 200f, 36f)) { VerticalAlignment = UIControlContentVerticalAlignment.Center, TextAlignment = UITextAlignment.Right, }; cost.SetDidChangeNotification(c => { string text = c.Text.Replace("$", string.Empty); decimal value; expenseViewModel.SelectedExpense.Cost = decimal.TryParse(text, out value) ? Math.Abs(value) : 0; }); descriptionCell = new UITableViewCell(UITableViewCellStyle.Default, null) { SelectionStyle = UITableViewCellSelectionStyle.None }; descriptionCell.AccessoryView = description = new PlaceholderTextView(new CGRect(0f, 0f, Theme.IsiOS7 ? 515f : 470f, 90f)) { BackgroundColor = UIColor.Clear, Placeholder = "Please enter notes here", }; description.SetDidChangeNotification(d => expenseViewModel.SelectedExpense.Description = description.Text != description.Placeholder ? d.Text : string.Empty ); photoCell = new UITableViewCell(UITableViewCellStyle.Default, null) { SelectionStyle = UITableViewCellSelectionStyle.None }; photoButton = UIButton.FromType(UIButtonType.Custom); photoButton.SetBackgroundImage(Theme.AddPhoto, UIControlState.Normal); photoButton.SetTitle("Add Photo", UIControlState.Normal); photoButton.SetTitleColor(Theme.LabelColor, UIControlState.Normal); photoButton.ContentEdgeInsets = new UIEdgeInsets(0f, 0f, 2f, 0f); photoButton.Frame = new CGRect(210f, 130f, 115f, 40f); photoButton.TouchUpInside += (sender, e) => { if (photoSheet == null) { photoSheet = new PhotoAlertSheet(); //Set the desired size for the resulting image var size = photo.Frame.Size; var scale = UIScreen.MainScreen.Scale; size.Width *= scale; size.Height *= scale; photoSheet.DesiredSize = size; //Set the callback for when the image is selected photoSheet.Callback = image => { if (expenseViewModel.Photo == null) { expenseViewModel.Photo = new ExpensePhoto { ExpenseId = expenseViewModel.SelectedExpense.Id } } ; expenseViewModel.Photo.Image = image.ToByteArray(); Load(enabled); }; } photoSheet.ShowFrom(photoButton.Frame, photoCell, true); }; photoCell.AddSubview(photoButton); var frame = photoCell.Frame; frame.X = 18f; frame.Width -= 34f; photo = new UIImageView(frame) { AutoresizingMask = UIViewAutoresizing.All, ContentMode = UIViewContentMode.ScaleAspectFit }; photo.Layer.BorderWidth = 1f; photo.Layer.BorderColor = new CGColor(0xcf, 0xcf, 0xcf, 0x7f); photo.Layer.CornerRadius = 10f; photo.Layer.MasksToBounds = true; photoCell.AddSubview(photo); }
private static void UpdateSelectionType(Cell element, UITableViewCell nativeView) { var isSelectable = CellBehavior.GetIsSelectable(element); nativeView.SelectionStyle = isSelectable ? UITableViewCellSelectionStyle.Default : UITableViewCellSelectionStyle.None; }
protected virtual void Initialize() { _settings = TinyIoCContainer.Current.Resolve <Settings>(); _settings.Synchronized += (sender, e) => { foreach (TextFieldCellController cell in _cells) { cell.Binding.SourceChanged(); } }; var url = new TextFieldCellController { Binding = new DataBinding { Source = _settings, SourceGetProperty = () => _settings.Url, SourceSetProperty = value => _settings.Url = (string)value, } }; url.Label.Text = "uTorrent URL"; url.TextField.KeyboardType = UIKeyboardType.Url; url.TextField.AutocorrectionType = UITextAutocorrectionType.No; url.TextField.AutocapitalizationType = UITextAutocapitalizationType.None; var port = new TextFieldCellController { Binding = new DataBinding { Source = _settings, SourceGetProperty = () => _settings.Port.ToString(), SourceSetProperty = value => _settings.Port = ((string)value).ToInt(), } }; port.Label.Text = "uTorrent Port"; port.TextField.KeyboardType = UIKeyboardType.NumberPad; var username = new TextFieldCellController { Binding = new DataBinding { Source = _settings, SourceGetProperty = () => _settings.Username, SourceSetProperty = value => _settings.Username = (string)value, } }; username.Label.Text = "Username"; username.TextField.AutocorrectionType = UITextAutocorrectionType.No; username.TextField.AutocapitalizationType = UITextAutocapitalizationType.None; var password = new TextFieldCellController { Binding = new DataBinding { Source = _settings, SourceGetProperty = () => _settings.Password, SourceSetProperty = value => _settings.Password = (string)value, } }; password.Label.Text = "Password"; password.TextField.SecureTextEntry = true; _cells = new TextFieldCellController[] { url, port, username, password, }; _aboutCell = new UITableViewCell(); _aboutCell.TextLabel.Text = "About uController"; _aboutCell.SelectionStyle = UITableViewCellSelectionStyle.Gray; _aboutCell.Accessory = UITableViewCellAccessory.DisclosureIndicator; }
public bool ShouldConfigureCell(MLPAutoCompleteTextField AutoCompleteTextField, UITableViewCell cell, string autoCompleteString, MLPAutoCompletionObject autoObject, Foundation.NSIndexPath NSIndexPath) { return(true); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell; switch (indexPath.Section) { case (int)SettingsViewSections.LoggedInUserInfo: cell = tableView.DequeueReusableCell("userInfoCell"); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "userInfoCell"); } cell.TextLabel.Font = UIFont.SystemFontOfSize(24); cell.ImageView.Image = UIImage.FromBundle("Images/Icon-User.png"); cell.TextLabel.Text = AppSession.LoggedInUser.UserName; cell.TextLabel.BackgroundColor = UIColor.Clear; return(cell); case (int)SettingsViewSections.PersistentLoginOption: cell = tableView.DequeueReusableCell("cell"); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "cell"); } cell.TextLabel.Text = "Keep Me Logged In"; if (swPersistentLogin == null) { swPersistentLogin = new UISwitch(); swPersistentLogin.ValueChanged += swPersistentLogin_ValueChanged; swPersistentLogin.On = AppSettings.PersistentLogin; } cell.AccessoryView = swPersistentLogin; return(cell); case (int)SettingsViewSections.QuestionSubmisionOptions: cell = tableView.DequeueReusableCell("cell"); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "cell"); } if (indexPath.Row == 0) { cell.TextLabel.Text = "Auto Advance Question"; if (swAutoAdvanceQuestion == null) { swAutoAdvanceQuestion = new UISwitch(); swAutoAdvanceQuestion.ValueChanged += swAutoAdvanceQuestion_ValueChanged; swAutoAdvanceQuestion.On = AppSettings.AutoAdvanceQuestion; } cell.AccessoryView = swAutoAdvanceQuestion; } else if (indexPath.Row == 1) { cell.TextLabel.Text = "Auto Submit Response"; if (swAutoSubmitResponse == null) { swAutoSubmitResponse = new UISwitch(); swAutoSubmitResponse.ValueChanged += swAutoSubmitResponse_ValueChanged; swAutoSubmitResponse.On = AppSettings.AutoSubmitResponse; } cell.AccessoryView = swAutoSubmitResponse; } return(cell); case (int)SettingsViewSections.SyncDataButton: cell = new UITableViewCell(UITableViewCellStyle.Default, null); btnSyncExam = new UIButton(UIButtonType.RoundedRect); btnSyncExam.Frame = cell.ContentView.Bounds; btnSyncExam.AutoresizingMask = UIViewAutoresizing.All; btnSyncExam.SetTitle("Sync Data", UIControlState.Normal); btnSyncExam.TouchUpInside += btnSyncExam_Clicked; cell.ContentView.AddSubview(btnSyncExam); return(cell); case (int)SettingsViewSections.LogoutButton: cell = new UITableViewCell(UITableViewCellStyle.Default, null); btnLogout = new UIButton(UIButtonType.RoundedRect); btnLogout.Frame = cell.ContentView.Bounds; btnLogout.AutoresizingMask = UIViewAutoresizing.All; btnLogout.SetTitle("Logout", UIControlState.Normal); btnLogout.TouchUpInside += btnLogout_Clicked; cell.ContentView.AddSubview(btnLogout); return(cell); } return(null); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell(ReachabilityTableCellIdentifier); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, ReachabilityTableCellIdentifier); var label = cell.TextLabel; label.Font = UIFont.SystemFontOfSize(12f); label.TextColor = UIColor.DarkGray; label.TextAlignment = UITextAlignment.Left; } string text = string.Empty; UIImage image = null; switch (indexPath.Section) { case 0: switch (remoteHostStatus) { case NetworkStatus.NotReachable: text = "Cannot connect to remote host"; image = imageStop; break; case NetworkStatus.ReachableViaCarrierDataNetwork: text = "Reachable via data carrier network"; image = imageCarrier; break; case NetworkStatus.ReachableViaWiFiNetwork: text = "Reachable via WiFi network"; image = imageWiFi; break; } break; case 1: switch (internetStatus) { case NetworkStatus.NotReachable: text = "Access not available"; image = imageStop; break; case NetworkStatus.ReachableViaCarrierDataNetwork: text = "Available via data carrier network"; image = imageCarrier; break; case NetworkStatus.ReachableViaWiFiNetwork: text = "Available via WiFi network"; image = imageWiFi; break; } break; case 2: switch (localWifiStatus) { case NetworkStatus.NotReachable: text = "Access not available"; image = imageStop; break; case NetworkStatus.ReachableViaWiFiNetwork: text = "Available via WiFi network"; image = imageWiFi; break; } break; } cell.TextLabel.Text = text; cell.ImageView.Image = image; return(cell); }
void IColorizeBackground.WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) { }
protected override UITableViewCell GetCellImpl(UITableView tv) { NSString key = _summarySection == -1 ? rkey1 : rkey2; var cell = tv.DequeueReusableCell(key); if (cell == null) { var style = _summarySection == -1 ? UITableViewCellStyle.Default : UITableViewCellStyle.Value1; cell = new UITableViewCell(style, key); cell.SelectionStyle = UITableViewCellSelectionStyle.Blue; } cell.TextLabel.Text = Caption; var radio = Group as RadioGroup; if (radio != null) { int selected = radio.Selected; int current = 0; foreach (var s in Sections) { foreach (var e in s.Elements) { if (!(e is RadioElement)) { continue; } if (current == selected) { cell.DetailTextLabel.Text = e.Summary(); goto le; } current++; } } } else if (Group != null) { int count = 0; foreach (var s in Sections) { foreach (var e in s.Elements) { var ce = e as CheckboxElement; if (ce != null) { if (ce.Value) { count++; } continue; } var be = e as ValueElement <bool>; if (be != null) { if (be.Value) { count++; } continue; } } } cell.DetailTextLabel.Text = count.ToString(); } else if (_summarySection != -1 && _summarySection < Sections.Count) { var s = Sections [_summarySection]; if (_summaryElement < s.Elements.Count && cell.DetailTextLabel != null) { cell.DetailTextLabel.Text = s.Elements [_summaryElement].Summary(); } } le: cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; return(cell); }
public static void Apply(UITableViewCell cell, string options = null) { ConfirmTrackBeamTheme(); ThemeManager.Current.Apply(cell); }
Style GenerateListItemTextStyle() { var font = new UITableViewCell(UITableViewCellStyle.Subtitle, "Foobar").TextLabel.Font; return(GenerateStyle(font)); }
protected override UITableViewCell GetCellImpl(UITableView tv) { var cell = tv.DequeueReusableCell(key); UIActivityIndicatorView activityIndicator; UILabel caption; if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, key); activityIndicator = new UIActivityIndicatorView { ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray, Tag = 1 }; caption = new UILabel { AdjustsFontSizeToFitWidth = false, Tag = 2 }; cell.ContentView.AddSubview(caption); cell.ContentView.AddSubview(activityIndicator); } else { activityIndicator = cell.ContentView.ViewWithTag(1) as UIActivityIndicatorView; caption = cell.ContentView.ViewWithTag(2) as UILabel; } if (Animating) { if (caption != null) { caption.Text = LoadingCaption; } if (activityIndicator != null) { activityIndicator.Hidden = false; activityIndicator.StartAnimating(); } } else { if (caption != null) { caption.Text = NormalCaption; } if (activityIndicator != null) { activityIndicator.Hidden = true; activityIndicator.StopAnimating(); } } if (BackgroundColor != null) { cell.ContentView.BackgroundColor = BackgroundColor ?? UIColor.Clear; } else { cell.ContentView.BackgroundColor = null; } if (caption != null) { caption.BackgroundColor = UIColor.Clear; caption.TextColor = TextColor ?? UIColor.Black; caption.Font = Font ?? UIFont.BoldSystemFontOfSize(16); caption.TextAlignment = Alignment; Layout(cell, activityIndicator, caption); } return(cell); }
public override void CellDisplayingEnded(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) { ((UploadCell)cell).Upload = null; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = null; //pIndexPath = indexPath.Row; // if (indexPath.Row == 0) // { // cell = tableView.DequeueReusableCell (kCellIdentifier) as UltrasoundParametersAndTheNonstressTestTableViewCell; // if (cell == null) // { // var views = NSBundle.MainBundle.LoadNib("UltrasoundParametersAndTheNonstressTestTableViewCell", cell, null); // cell = views.GetItem<UltrasoundParametersAndTheNonstressTestTableViewCell>(0); // } // var TestNameLabel = cell.ViewWithTag (3200) as UILabel; // var TestDescriptionLabel = cell.ViewWithTag (3300) as UILabel; // TestNameLabel.Text = testList[indexPath.Row]; // TestDescriptionLabel.Text = testDescription[indexPath.Row]; // } // else // { cell = tableView.DequeueReusableCell(kCellIdentifier) as UltrasoundParametersAndTheNonstressTestTableViewCell; if (cell == null) { var views = NSBundle.MainBundle.LoadNib("UltrasoundParametersAndTheNonstressTestTableViewCell", cell, null); cell = views.GetItem <UltrasoundParametersAndTheNonstressTestTableViewCell>(0); } var TestNameLabel = cell.ViewWithTag(3200) as UILabel; var TestDescriptionLabel = cell.ViewWithTag(3300) as UILabel; TestNameLabel.Text = testList[indexPath.Row]; TestDescriptionLabel.Text = testDescription[indexPath.Row]; //TestNameLabel.BackgroundColor = UIColor.White; //TestDescriptionLabel.BackgroundColor = UIColor.White; //cell.BackgroundColor = UIColor.Black; //cell.BackgroundColor = UIColor.Purple; // if (indexPath.Row == 0) { // cell.BackgroundColor = UIColor.Red; // } // if (indexPath.Row == 1) { // cell.BackgroundColor = UIColor.Blue; // } // if (indexPath.Row == 2) { // cell.BackgroundColor = UIColor.Green; // } // if (indexPath.Row == 3) { // cell.BackgroundColor = UIColor.Gray; // } // if (indexPath.Row == 4) { // cell.BackgroundColor = UIColor.Purple; // } //} // if (indexPath.Row == 0) { // cell.BackgroundColor = UIColor.Red; // } // UITableViewCell cell = null; // // cell = tableView.DequeueReusableCell (kCellIdentifier); // if (cell == null) // { // //var views = NSBundle.MainBundle.LoadNib("FifthTableViewCell", cell, null); // //cell = views.GetItem<FifthTableViewCell>(0); // cell = new UITableViewCell(); // } // cell.BackgroundColor = UIColor.Red; return(cell); }
public static void SetEditingStyle([NotNull] this UITableViewCell cell, UITableViewCellEditingStyle editingStyle) { Should.NotBeNull(cell, nameof(cell)); cell.SetBindingMemberValue(AttachedMembers.UITableViewCell.EditingStyle, editingStyle); }
private void BindCellDelegate(UITableViewCell cell, Person person, NSIndexPath path) { cell.TextLabel.Text = person.FullName; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = null; switch (indexPath.Section) { case 0: switch (indexPath.Row) { case 0: { var toggleCell = (ProductViewControllerToggleTableViewCell)tableView.DequeueReusableCell("ProductViewControllerToggleCell", indexPath); toggleCell.ToggleSwitch.ValueChanged -= ToggleProductViewControllerDemo; toggleCell.TextLabel.Text = "Demo BUYProductViewController"; toggleCell.ToggleSwitch.On = demoProductViewController; toggleCell.ToggleSwitch.ValueChanged += ToggleProductViewControllerDemo; cell = toggleCell; } break; case 1: { var themeCell = (ProductViewControllerThemeStyleTableViewCell)TableView.DequeueReusableCell("ThemeStyleCell", indexPath); themeCell.SegmentedControl.ValueChanged -= ToggleProductViewControllerThemeStyle; themeCell.SegmentedControl.SelectedSegment = (int)themeStyle; themeCell.SegmentedControl.ValueChanged += ToggleProductViewControllerThemeStyle; cell = themeCell; } break; case 2: { var themeCell = (ProductViewControllerThemeTintColorTableViewCell)TableView.DequeueReusableCell("ThemeTintColorCell", indexPath); themeCell.SegmentedControl.ValueChanged -= ToggleProductViewControllerTintColorSelection; themeCell.SegmentedControl.SelectedSegment = themeTintColorSelectedIndex; themeCell.SegmentedControl.ValueChanged += ToggleProductViewControllerTintColorSelection; cell = themeCell; } break; case 3: { var toggleCell = (ProductViewControllerToggleTableViewCell)TableView.DequeueReusableCell("ThemeShowsBackgroundToggleCell", indexPath); toggleCell.ToggleSwitch.ValueChanged -= ToggleShowsProductImageBackground; toggleCell.TextLabel.Text = "Product Image in Background"; toggleCell.ToggleSwitch.On = showsProductImageBackground; toggleCell.ToggleSwitch.ValueChanged += ToggleShowsProductImageBackground; cell = toggleCell; } break; case 4: { var toggleCell = (ProductViewControllerToggleTableViewCell)TableView.DequeueReusableCell("ProductViewControllerPresentViewControllerToggleCell", indexPath); toggleCell.ToggleSwitch.ValueChanged -= TogglePresentViewController; toggleCell.TextLabel.Text = "Modal Presentation"; toggleCell.ToggleSwitch.On = presentViewController; toggleCell.ToggleSwitch.ValueChanged -= TogglePresentViewController; cell = toggleCell; } break; } break; case 1: { cell = TableView.DequeueReusableCell("Cell", indexPath); cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; var product = products [indexPath.LongRow]; cell.TextLabel.Text = product.Title; } break; } return(cell); }
void RemoveSpinner(UITableViewCell cell, UIActivityIndicatorView spinner) { spinner.StopAnimating(); spinner.RemoveFromSuperview(); cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; }
private void BindCell(UITableViewCell cell, string item, NSIndexPath path) { cell.TextLabel.Text = item; IconMapper.MapMenuTextLabel(cell.TextLabel); cell.BackgroundColor = EpamStyles.PrimaryColor1; }
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) { cell.BackgroundColor = UIColor.Clear; }