private UITableViewCell CreateConfidenceCell() { _confidenceToggle = new UIStepper { MinimumValue = Constants.ConfidenceMinValue, MaximumValue = Constants.ConfidenceMaxValue, StepValue = Constants.StepValue, Value = NSUserDefaults.StandardUserDefaults.DoubleForKey(Constants.ConfidenceThresholdUserDefaultName) * 100, TranslatesAutoresizingMaskIntoConstraints = false }; _confidenceToggle.ValueChanged += ConfidenceToggle_ValueChanged; _confidenceLabel = new UILabel { Text = string.Format(CultureInfo.CurrentCulture, Constants.ConfidenceLabelFormat, _confidenceToggle.Value), Font = UIFont.SystemFontOfSize(Constants.TableFontSize), TextColor = Constants.SettingsSubheadingTextColour, TranslatesAutoresizingMaskIntoConstraints = false }; var confidenceCell = new UITableViewCell(); confidenceCell.TextLabel.Text = Constants.ConfidenceCellLabel; confidenceCell.TextLabel.AdjustsFontForContentSizeCategory = true; confidenceCell.BackgroundColor = UIColor.White; confidenceCell.TranslatesAutoresizingMaskIntoConstraints = false; confidenceCell.AddSubview(_confidenceToggle); confidenceCell.AddSubview(_confidenceLabel); NSLayoutConstraint.Create(_confidenceToggle, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, _confidenceToggle.Superview, NSLayoutAttribute.Trailing, 1f, Constants.ToggleTrailingMargin).Active = true; NSLayoutConstraint.Create(_confidenceToggle, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _confidenceToggle.Superview, NSLayoutAttribute.Top, 1f, Constants.ToggleTopMargin).Active = true; NSLayoutConstraint.Create(_confidenceToggle, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, Constants.CellHeight).Active = true; NSLayoutConstraint.Create(_confidenceToggle, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, Constants.ToggleWidth).Active = true; NSLayoutConstraint.Create(_confidenceLabel, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, _confidenceLabel.Superview, NSLayoutAttribute.Trailing, 1f, Constants.ConfidenceLabelTrailingMargin).Active = true; NSLayoutConstraint.Create(_confidenceLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _confidenceLabel.Superview, NSLayoutAttribute.Top, 1f, 0.0f).Active = true; NSLayoutConstraint.Create(_confidenceLabel, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, Constants.CellHeight).Active = true; NSLayoutConstraint.Create(_confidenceLabel, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, Constants.ConfidenceLabelWidth).Active = true; return(confidenceCell); }
public CustomCellController2() : base() { base.View.AddSubview(cell); cell.AddSubview(lblHeading); cell.AddSubview(lblSubHeading); cell.AddSubview(imgMain); imgMain.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin; lblHeading.TextColor = UIColor.Brown; lblHeading.Font = UIFont.SystemFontOfSize(32); lblSubHeading.TextColor = UIColor.DarkGray; lblSubHeading.Font = UIFont.SystemFontOfSize(13); }
public override UITableViewCell GetCell (UITableView tv) { sc = new UISegmentedControl () { BackgroundColor = UIColor.Clear, Tag = 1, }; sc.Selected = true; sc.InsertSegment (choices [0].Text, 0, false); sc.InsertSegment (choices [1].Text, 1, false); sc.Frame = new RectangleF (570f, 8f, 150f, 26f); sc.SelectedSegment = choices.FindIndex (e => e.Id == val.Id); sc.AddTarget (delegate { Value = choices [sc.SelectedSegment]; }, UIControlEvent.ValueChanged); var cell = tv.DequeueReusableCell (CellKey); // if (cell == null) { cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.AddSubview (sc); // } // else // RemoveTag (cell, 1); cell.TextLabel.Font = UIFont.BoldSystemFontOfSize (17); //cell.Frame.Height = 44; cell.TextLabel.Text = Caption; if (this.IsMandatory) cell.TextLabel.Text += "*"; return cell; }
private UITableViewCell CreateGalleryCell() { _galleryToggle = new UISwitch { On = NSUserDefaults.StandardUserDefaults.BoolForKey(Constants.GallerySettingsSwitchState) }; _galleryToggle.ValueChanged += GalleryToggle_ValueChanged; _galleryToggle.TranslatesAutoresizingMaskIntoConstraints = false; var galleryCell = new UITableViewCell(); galleryCell.TextLabel.Text = Constants.GalleryCellLabel; galleryCell.TextLabel.AdjustsFontForContentSizeCategory = true; galleryCell.BackgroundColor = UIColor.White; galleryCell.TranslatesAutoresizingMaskIntoConstraints = false; galleryCell.AddSubview(_galleryToggle); NSLayoutConstraint.Create(_galleryToggle, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, _galleryToggle.Superview, NSLayoutAttribute.Trailing, 1f, Constants.GalleryToggleTrailingMargin).Active = true; NSLayoutConstraint.Create(_galleryToggle, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _galleryToggle.Superview, NSLayoutAttribute.Top, 1f, Constants.ToggleTopMargin).Active = true; NSLayoutConstraint.Create(_galleryToggle, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, Constants.CellHeight).Active = true; NSLayoutConstraint.Create(_galleryToggle, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, Constants.ToggleWidth).Active = true; return(galleryCell); }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(this.CellKey); UIImageView iv = null; if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, this.CellKey); iv = new UIImageView(new RectangleF(10f, 5f, tv.Bounds.Width - 20f, this.MaxHeight - 10f)); iv.Tag = 101; iv.ContentMode = UIViewContentMode.ScaleAspectFit; cell.AddSubview(iv); } else { iv = cell.ViewWithTag(101) as UIImageView; } if (this.barcodeImg == null) { var writer = new BarcodeWriter() { Format = this.format }; this.barcodeImg = writer.Write(this.value); } iv.Image = this.barcodeImg; return(cell); }
public override UITableViewCell GetCell (UITableView tv) { var cell = tv.DequeueReusableCell(this.CellKey); UIImageView iv = null; if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, this.CellKey); iv = new UIImageView(new RectangleF(10f, 5f, tv.Bounds.Width - 20f, this.MaxHeight - 10f)); iv.Tag = 101; iv.ContentMode = UIViewContentMode.ScaleAspectFit; cell.AddSubview(iv); } else { iv = cell.ViewWithTag(101) as UIImageView; } iv.Image = this.Image; return cell; }
public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { var cell = new UITableViewCell(UITableViewCellStyle.Default, "loadingcell"); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.AddSubview(CellActivity(tableView)); return(cell); }
UITableViewCell CellContentFactoryImplementationForPerson1 () { UITableViewCell cc = new UITableViewCell(); UIView content_view = UIViewFactory(); // wrap UIView cc.Bounds = content_view.Bounds; cc.AddSubview(content_view); return cc; }
protected void GetCellImplInternal(UITableView tv, UITableViewCell cell) { float padding = 13.5f, dialCodeFieldLeftPadding = 60; CoreGraphics.CGRect rect = cell.Frame.SetX(padding + dialCodeFieldLeftPadding).SetWidth(UIScreen.MainScreen.Bounds.Width - 2 * 8 - 2 * padding - dialCodeFieldLeftPadding); // screenwidth - margin - padding _phoneNumberTextEdit = new UITextField(rect) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleLeftMargin, Placeholder = "", Tag = 1, SecureTextEntry = false, TintColor = UIColor.Black, TextColor = UIColor.FromRGB(44, 44, 44), Font = UIFont.FromName(FontName.HelveticaNeueLight, 38 / 2), VerticalAlignment = UIControlContentVerticalAlignment.Center, AdjustsFontSizeToFitWidth = true, AutocapitalizationType = UITextAutocapitalizationType.None, KeyboardType = UIKeyboardType.NumberPad }; _phoneNumberTextEdit.Placeholder = _placeHolder; _phoneNumberTextEdit.AdjustsFontSizeToFitWidth = true; _phoneNumberTextEdit.SetHeight(21).IncrementY(11); _phoneNumberTextEdit.EditingChanged += AfterTextChanged; _phoneNumberTextEdit.AccessibilityLabel = _phoneNumberTextEdit.Placeholder; _phoneDialCodeLabel = new CountrySelector(cell.Frame.SetX(0).SetWidth(50)) { Font = UIFont.FromName(FontName.HelveticaNeueLight, 38 / 2), TintColor = UIColor.Black, TextColor = UIColor.FromRGB(44, 44, 44), TextAlignment = UITextAlignment.Center, AdjustsFontSizeToFitWidth = true }; _phoneDialCodeLabel.SetHeight(_phoneNumberTextEdit.Frame.Height).IncrementY(11).SetX(padding); _phoneDialCodeLabel.Configure(_navigationController, CountryCode.GetCountryCodeByIndex(CountryCode.GetCountryCodeIndexByCountryISOCode(Value.Country)), OnDialCodeSelected); _phoneDialCodeLabel.AccessibilityLabel = Localize.GetValue("DialCodeSelectorTitle"); cell.AddSubview(_phoneDialCodeLabel); cell.AddSubview(_phoneNumberTextEdit); _phoneNumberInfoDatasourceChanged(); }
public override void ViewDidLoad() { base.ViewDidLoad(); var btnAddBookmark = new UIBarButtonItem(); btnAddBookmark.Image = UIImage.FromFile("add.png"); btnAddBookmark.Clicked += delegate { setEditMode(UITableViewCellEditingStyle.Insert); }; var btnDeleteBookmark = new UIBarButtonItem(); btnDeleteBookmark.Image = UIImage.FromFile("delete.png"); btnDeleteBookmark.Clicked += delegate { setEditMode(UITableViewCellEditingStyle.Delete); }; var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Bookmarks".t(); var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { btnAddBookmark, btnDeleteBookmark, space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _bookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain); _bookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; _bookmarksTable.Source = new DataSource(this); View.AddSubview(_bookmarksTable); _newBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null); _newBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin; _newBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55); _newBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31)); _newBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _newBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect; _newBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f); _newBookmarkCell.AddSubview(_newBookmarkNameTxt); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Create toolbar, title label and buttons var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin; toolBar.BarStyle = UIBarStyle.Black; var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.TextColor = UIColor.White; toolBarTitle.Font = UIFont.SystemFontOfSize(18.0f); toolBarTitle.Text = "Bookmarks".t(); var btnAddBookmark = new UIButton(new RectangleF(5, 5, 30, 30)); btnAddBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkAdd32.png"), UIControlState.Normal); btnAddBookmark.TouchUpInside += delegate { SetEditingMode(UITableViewCellEditingStyle.Insert); }; var btnDeleteBookmark = new UIButton(new RectangleF(43, 5, 30, 30)); btnDeleteBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkDelete32.png"), UIControlState.Normal); btnDeleteBookmark.TouchUpInside += delegate { SetEditingMode(UITableViewCellEditingStyle.Delete); }; toolBar.AddSubview(toolBarTitle); toolBar.AddSubview(btnAddBookmark); toolBar.AddSubview(btnDeleteBookmark); View.AddSubview(toolBar); // Create bookmarks table _BookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain); _BookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _BookmarksTable.RowHeight = 55; _BookmarksTable.Source = new DataSource(this); View.AddSubview(_BookmarksTable); // Create bookmark cell and text field _NewBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null); _NewBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin; _NewBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55); _NewBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31)); _NewBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _NewBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect; _NewBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f); _NewBookmarkCell.AddSubview(_NewBookmarkNameTxt); }
void setupSwipingView() { if (contentScreenshotView != null) { return; } // If the content view background is transparent we get the background color. bool isContentViewBackgroundClear = (cell.ContentView.BackgroundColor != null); if (isContentViewBackgroundClear) { bool isBackgroundClear = (cell.BackgroundColor == UIColor.Clear); cell.ContentView.BackgroundColor = isBackgroundClear ? UIColor.White : cell.BackgroundColor; } UIImage contentViewScreenshotImage = imageWithView(cell); if (isContentViewBackgroundClear) { cell.ContentView.BackgroundColor = null; } ; colorIndicatorView = new UIView(cell.Bounds); colorIndicatorView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; colorIndicatorView.BackgroundColor = DefaultColor ?? UIColor.Clear; cell.AddSubview(colorIndicatorView); slidingView = new UIView(); slidingView.ContentMode = UIViewContentMode.Center; colorIndicatorView.AddSubview(slidingView); contentScreenshotView = new UIImageView(contentViewScreenshotImage); cell.AddSubview(contentScreenshotView); }
private UITableViewCell BitrateTableViewCellForTableView(UITableView tableView, NSIndexPath indexPath) { var dequeueIdentifier = "ARDSettingsBitrateCellIdentifier"; var cell = tableView.DequeueReusableCell(dequeueIdentifier); if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, dequeueIdentifier); var textField = new UITextField(new CGRect(10, 0, cell.Bounds.Width - 20, cell.Bounds.Size.Height)); var currentMaxBitrate = _settingsModel.CurrentMaxBitrateSettingFromStore.HasValue ? _settingsModel.CurrentMaxBitrateSettingFromStore.Value.ToString() : ""; textField.Text = currentMaxBitrate; textField.Placeholder = "Enter max bit rate (kbps)"; textField.KeyboardType = UIKeyboardType.NumberPad; var numberToolbar = new UIToolbar(new CGRect(0, 0, View.Bounds.Size.Width, 50)); numberToolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Apply", UIBarButtonItemStyle.Done, (s, e) => { View.EndEditing(true); }) }; numberToolbar.SizeToFit(); textField.EditingDidEnd += (sender, e) => { if (int.TryParse(textField.Text, out int bitrate)) { _settingsModel.StoreMaxBitrateSetting(bitrate); } else { _settingsModel.StoreMaxBitrateSetting(null); } }; textField.InputAccessoryView = numberToolbar; cell.AddSubview(textField); } return(cell); }
// Customize the appearance of table view cells. public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { if (movies == null || movies.Count < 1) { UITableViewCell cellLoading = new UITableViewCell(); UIActivityIndicatorView indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray); indicator.StartAnimating(); indicator.Frame = cellLoading.Frame; cellLoading.AddSubview(indicator); return(cellLoading); } var cell = tableView.DequeueReusableCell(MovieListCell.CellId) as MovieListCell ?? new MovieListCell(); cell.Movie = movies [indexPath.Section] [indexPath.Row]; cell.AccessibilityIdentifier = "section" + indexPath.Section.ToString() + "-row" + indexPath.Row.ToString(); return(cell); }
public override void ConfigureCell(UITableViewCell cell, RecentSearch recentSearch) { cell.TextLabel.Text = string.Format("{0:s}", recentSearch.Search.DisplayText); cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; UILabel leftHandLabel = (UILabel)cell.ViewWithTag(10); if (leftHandLabel == null) { leftHandLabel = new UILabel(); leftHandLabel.Font = UIFont.SystemFontOfSize(12.0f); leftHandLabel.Tag = 10; leftHandLabel.Frame = new RectangleF(cell.Frame.Size.Width - 100, 0, 60, 30); leftHandLabel.BackgroundColor = UIColor.Clear; leftHandLabel.TextAlignment = UITextAlignment.Right; cell.AddSubview(leftHandLabel); } leftHandLabel.Text = recentSearch.ResultsCount.ToString(); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { string CellIdentifier = "TableCell"; UITableViewCell cell = tableView.DequeueReusableCell(CellIdentifier) ?? new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier); this.CellHeight = 0; var orderedOutputs = this.OutputFieldProperty.OrderBy(a => a.OrderIndex); foreach (var output in orderedOutputs) { if (!output.Hidden) { object value; if (this.ObjectList[indexPath.Row].GetType() == typeof(JObject)) { var jsonObj = this.ObjectList[indexPath.Row] as JObject; value = jsonObj?.GetValue(output.Id.ToLower()); } else { var propertyInfo = this.ObjectList[indexPath.Row].GetType().GetProperty(output.Id); value = propertyInfo?.GetValue(this.ObjectList[indexPath.Row], null); } if (value != null) { var manager = this.MyFormHandler.ManagersCollection.OutputManagerCollection.GetManager(output.Type); var outputView = manager.GetView(output, value, this.MyFormHandler, null, null, (int)this.CellHeight); cell.AddSubview(outputView); this.CellHeight += outputView.Frame.Height + 10; } } } //this.TableHeight += this.CellHeight; //var size = new CGSize(tableView.Frame.Width, this.TableHeight); //tableView.Frame = new CGRect(new CGPoint(tableView.Frame.X, tableView.Frame.Y), size); //this.View.Frame = new CGRect(new CGPoint(this.View.Frame.X, this.View.Frame.Y), size); return(cell); }
private UITableViewCell BuildNextResultsCell(string text, float tableWidth) { var cell = new UITableViewCell(UITableViewCellStyle.Default, "lastcell"); cell.TextLabel.Text = text; cell.TextLabel.Font = UIFont.BoldSystemFontOfSize(15); cell.TextLabel.TextAlignment = UITextAlignment.Center; cell.SelectionStyle = UITableViewCellSelectionStyle.None; if (_pagingActivity != null) { _pagingActivity.RemoveFromSuperview(); } _pagingActivity = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray); _pagingActivity.Frame = new RectangleF((tableWidth - 32) / 2, 4, 32, 32); _pagingActivity.HidesWhenStopped = true; cell.AddSubview(_pagingActivity); _pagingCell = cell; return(cell); }
private UITableViewCell BuildNextResultsCell(string text, float tableWidth) { var cell = new UITableViewCell(UITableViewCellStyle.Default, "lastcell"); cell.TextLabel.Text = text; cell.TextLabel.Font = UIFont.BoldSystemFontOfSize(15); cell.TextLabel.TextAlignment = UITextAlignment.Center; cell.SelectionStyle = UITableViewCellSelectionStyle.None; if (_pagingActivity != null) _pagingActivity.RemoveFromSuperview(); _pagingActivity = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray); _pagingActivity.Frame = new RectangleF((tableWidth - 32) / 2, 4, 32, 32); _pagingActivity.HidesWhenStopped = true; cell.AddSubview(_pagingActivity); _pagingCell = cell; return cell; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = new UITableViewCell(UITableViewCellStyle.Default, "loadingcell"); cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.AddSubview(CellActivity(tableView)); return cell; }
public TableSource() { expenseViewModel = ServiceContainer.Resolve <ExpenseViewModel>(); categoryCell = new UITableViewCell(UITableViewCellStyle.Default, null); categoryCell.TextLabel.Text = "Category"; categoryCell.AccessoryView = category = new UILabel(new RectangleF(0, 0, 200, 36)) { TextAlignment = UITextAlignment.Right, BackgroundColor = UIColor.Clear, }; categoryCell.SelectionStyle = UITableViewCellSelectionStyle.None; costCell = new UITableViewCell(UITableViewCellStyle.Default, null); costCell.TextLabel.Text = "Cost"; costCell.SelectionStyle = UITableViewCellSelectionStyle.None; costCell.AccessoryView = cost = new UITextField(new RectangleF(0, 0, 200, 36)) { VerticalAlignment = UIControlContentVerticalAlignment.Center, TextAlignment = UITextAlignment.Right, }; cost.SetDidChangeNotification(c => { string text = c.Text.Replace("$", string.Empty); decimal value; if (decimal.TryParse(text, out value)) { expenseViewModel.SelectedExpense.Cost = Math.Abs(value); } else { expenseViewModel.SelectedExpense.Cost = 0; } }); descriptionCell = new UITableViewCell(UITableViewCellStyle.Default, null); descriptionCell.AccessoryView = description = new PlaceholderTextView(new RectangleF(0, 0, 470, 90)) { BackgroundColor = UIColor.Clear, Placeholder = "Please enter notes here", }; descriptionCell.SelectionStyle = UITableViewCellSelectionStyle.None; description.SetDidChangeNotification(d => { if (description.Text != description.Placeholder) { expenseViewModel.SelectedExpense.Description = d.Text; } else { expenseViewModel.SelectedExpense.Description = string.Empty; } }); photoCell = new UITableViewCell(UITableViewCellStyle.Default, null); photoCell.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(0, 0, 2, 0); photoButton.Frame = new RectangleF(210, 130, 115, 40); 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 = 18; frame.Width -= 34; photo = new UIImageView(frame); photo.AutoresizingMask = UIViewAutoresizing.All; photo.ContentMode = UIViewContentMode.ScaleAspectFit; photo.Layer.BorderWidth = 1; photo.Layer.BorderColor = new CGColor(0xcf, 0xcf, 0xcf, 0x7f); photo.Layer.CornerRadius = 10; photo.Layer.MasksToBounds = true; photoCell.AddSubview(photo); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = null; string cellIdentifier; cellIdentifier = GetCellName(indexPath); if (indexPath.Section == coordinatsSection) { SettingsCoordinatesTableCell settingsCoordinatesTableCell = tableView.DequeueReusableCell(cellIdentifier) as SettingsCoordinatesTableCell; settingsCoordinatesTableCell.BackgroundColor = ColorHelper.FromType(ColorType.SecondarySystemGroupedBackground); settingsCoordinatesTableCell.LabInfo.TextColor = ColorHelper.FromType(ColorType.Label); settingsCoordinatesTableCell.LabInfo.Text = LangUtil.Get("SettingsViewController.Coordinates.Info"); settingsCoordinatesTableCell.LabInfo.Font = FontConst.fontSmall; string coordinateButtonText = ""; CoordinateFormat coordinateFormat = UserUtil.Current.format; if (coordinateFormat == CoordinateFormat.DD) { coordinateButtonText = LangUtil.Get("SettingsViewController.Coordinates.DD"); } else if (coordinateFormat == CoordinateFormat.DDM) { coordinateButtonText = LangUtil.Get("SettingsViewController.Coordinates.DDM"); } else if (coordinateFormat == CoordinateFormat.DMS) { coordinateButtonText = LangUtil.Get("SettingsViewController.Coordinates.DMS"); } else if (coordinateFormat == CoordinateFormat.UTM) { coordinateButtonText = LangUtil.Get("SettingsViewController.Coordinates.UTM"); } else { coordinateButtonText = LangUtil.Get("SettingsViewController.Coordinates.DDM"); } settingsCoordinatesTableCell.LabValue.TextColor = ColorHelper.FromType(ColorType.Label); settingsCoordinatesTableCell.LabValue.Text = coordinateButtonText; settingsCoordinatesTableCell.LabValue.Font = FontConst.fontMediumRegular; settingsCoordinatesTableCell.BackgroundColor = ColorHelper.FromType(ColorType.SecondarySystemGroupedBackground); cell = settingsCoordinatesTableCell; } else if (indexPath.Section == locationSection) { // Location LocationServiceAccess locationServiceAccess = AppDelegate.current.locationManager.GetLocationServiceAccess(); SettingsLocationTableCell settingsLocationTableCell = tableView.DequeueReusableCell(cellIdentifier) as SettingsLocationTableCell; settingsLocationTableCell.LabInfo.Text = LangUtil.Get("SettingsViewController.Location.Info"); settingsLocationTableCell.LabLeft.Text = LangUtil.Get("SettingsViewController.Location.Text"); if (locationServiceAccess == LocationServiceAccess.always) { settingsLocationTableCell.LabRight.Text = LangUtil.Get("SettingsViewController.Location.Always"); } else if (locationServiceAccess == LocationServiceAccess.onlyWhenInUse) { settingsLocationTableCell.LabRight.Text = LangUtil.Get("SettingsViewController.Location.OnlyWhenInUse"); } else if (locationServiceAccess == LocationServiceAccess.notAllowed) { settingsLocationTableCell.LabRight.Text = LangUtil.Get("SettingsViewController.Location.NotAllowed"); } else { settingsLocationTableCell.LabRight.Text = LangUtil.Get("SettingsViewController.Location.Unset"); } // if (locationServiceAccess == LocationServiceAccess.always) if (locationServiceAccess == LocationServiceAccess.onlyWhenInUse) { settingsLocationTableCell.LabInfo.TextColor = ColorHelper.FromType(ColorType.Label); settingsLocationTableCell.LabInfo.Font = FontConst.fontSmall; settingsLocationTableCell.LabLeft.TextColor = ColorHelper.FromType(ColorType.Label); settingsLocationTableCell.LabLeft.Font = FontConst.fontMediumRegular; settingsLocationTableCell.LabRight.TextColor = ColorHelper.FromType(ColorType.Label); settingsLocationTableCell.LabRight.Font = FontConst.fontMediumRegular; settingsLocationTableCell.BackgroundColor = ColorHelper.FromType(ColorType.SecondarySystemGroupedBackground); } else { settingsLocationTableCell.LabInfo.TextColor = ColorHelper.FromType(ColorType.LightText); settingsLocationTableCell.LabInfo.Font = FontConst.fontSmall; settingsLocationTableCell.LabLeft.TextColor = ColorHelper.FromType(ColorType.LightText); settingsLocationTableCell.LabLeft.Font = FontConst.fontMediumRegular; settingsLocationTableCell.LabRight.TextColor = ColorHelper.FromType(ColorType.LightText); settingsLocationTableCell.LabRight.Font = FontConst.fontMediumRegular; settingsLocationTableCell.BackgroundColor = ColorHelper.FromType(ColorType.RedBackground); } cell = settingsLocationTableCell; } else if (indexPath.Section == concentSection) { SettingsTopInfoTableCell settingsTopInfoTableCell = tableView.DequeueReusableCell(cellIdentifier) as SettingsTopInfoTableCell; settingsTopInfoTableCell.BackgroundColor = UIColor.Clear; settingsTopInfoTableCell.LabInfo.TextColor = ColorHelper.FromType(ColorType.Label); settingsTopInfoTableCell.LabInfo.Font = FontConst.fontLarge; if (indexPath.Section == concentSection) { // settingsInfoTableCell.AccessibilityLabel = LangUtil.Get("SettingsViewController.Concent.Accessibility.Label"); // settingsInfoTableCell.AccessibilityHint = LangUtil.Get("SettingsViewController.Concent.Accessibility.Hint"); if (UserUtil.Current.consentAgreed == ConsentAgreed.True) { settingsTopInfoTableCell.BackgroundColor = ColorHelper.FromType(ColorType.SecondarySystemGroupedBackground); settingsTopInfoTableCell.LabInfo.TextColor = ColorHelper.FromType(ColorType.Label); } else { settingsTopInfoTableCell.BackgroundColor = ColorHelper.FromType(ColorType.RedBackground); settingsTopInfoTableCell.LabInfo.TextColor = ColorHelper.FromType(ColorType.LightText); } } string text = ""; if (indexPath.Section == informationSection) { if (indexPath.Row == 0) { text = LangUtil.Get("SettingsViewController.Information.Text"); } else if (indexPath.Row == 1) { text = LangUtil.Get("SettingsViewController.Information.Text2"); } } else if (indexPath.Section == concentSection) { text = LangUtil.Get("SettingsViewController.Concent.Text"); } settingsTopInfoTableCell.LabInfo.Text = text; cell = settingsTopInfoTableCell; } else if (indexPath.Section == informationSection) { SettingsInfoTableCell settingsInfoTableCell = tableView.DequeueReusableCell(cellIdentifier) as SettingsInfoTableCell; settingsInfoTableCell.BackgroundColor = ColorHelper.FromType(ColorType.SecondarySystemGroupedBackground); settingsInfoTableCell.LabLabel.TextColor = ColorHelper.FromType(ColorType.Label); settingsInfoTableCell.LabLabel.Font = FontConst.fontLarge; if (indexPath.Section == concentSection) { // settingsInfoTableCell.AccessibilityLabel = LangUtil.Get("SettingsViewController.Concent.Accessibility.Label"); // settingsInfoTableCell.AccessibilityHint = LangUtil.Get("SettingsViewController.Concent.Accessibility.Hint"); if (UserUtil.Current.consentAgreed == ConsentAgreed.True) { settingsInfoTableCell.BackgroundColor = UIColor.Clear; settingsInfoTableCell.LabLabel.TextColor = ColorHelper.FromType(ColorType.Label); } else { settingsInfoTableCell.BackgroundColor = ColorHelper.FromType(ColorType.RedBackground); settingsInfoTableCell.LabLabel.TextColor = ColorHelper.FromType(ColorType.LightText); } } string text = ""; if (indexPath.Section == informationSection) { if (indexPath.Row == 0) { text = LangUtil.Get("SettingsViewController.Information.Text"); } else if (indexPath.Row == 1) { text = LangUtil.Get("SettingsViewController.Information.Text2"); } } else if (indexPath.Section == concentSection) { text = LangUtil.Get("SettingsViewController.Concent.Text"); } settingsInfoTableCell.LabLabel.Text = text; cell = settingsInfoTableCell; } int lineThickness = 1; CGRect bottomLineframe = new CGRect(0, cell.Frame.Height - lineThickness, tableView.Bounds.Size.Width, lineThickness); UIView bottomLine = new UIView(bottomLineframe); bottomLine.BackgroundColor = ColorHelper.FromType(ColorType.Separator); CGRect topLineframe = new CGRect(0, 0, tableView.Bounds.Size.Width, lineThickness); UIView topLine = new UIView(topLineframe); topLine.BackgroundColor = ColorHelper.FromType(ColorType.Separator); cell.AddSubview(bottomLine); cell.AddSubview(topLine); return(cell); }
/// <summary> /// Configures the cell. /// </summary> /// <param name="cell">Cell.</param> /// <param name="classCategory">Class name.</param> private void ConfigureCell(UITableViewCell cell, Category classCategory) { // Set up cell attributes TableView.RowHeight = Constants.TableRowHeight; cell.Frame = new CGRect(0, 0, Constants.TableRowWidth, Constants.TableRowHeight); // Elements in cell var classLabel = new UITextView(); var countText = new UITextView(); var checkBox = new UIButton(); var colourButton = new UIButton(); // Create a Colour Picker view controller var colorPopup = new ColourPickerViewController { Observations = Bindings, Category = classLabel, ClickedButton = colourButton, ParentTableView = this, ModalPresentationStyle = UIModalPresentationStyle.OverFullScreen, RootResultsViewController = ParentResultsViewController }; countText.UserInteractionEnabled = false; colourButton.BackgroundColor = classCategory.Color.ToUIColor(); colourButton.Frame = new CGRect(Constants.TableRowMargin, Constants.TableRowHeight / 2 - Constants.ColourButtonSize / 2, Constants.ColourButtonSize, Constants.ColourButtonSize); colourButton.Layer.CornerRadius = Constants.ColourButtonSize / 2; colourButton.TouchUpInside += (sender, e) => { // Present the popover PresentViewController(colorPopup, false, null); }; ConfigureColourButtonVoiceoverAccessibilityAttributes(colourButton, classCategory.Color.ToCGColor()); classLabel.TextAlignment = UITextAlignment.Left; classLabel.UserInteractionEnabled = false; classLabel.Font = UIFont.GetPreferredFontForTextStyle(UIFontTextStyle.Body); classLabel.AdjustsFontForContentSizeCategory = true; classLabel.Text = classCategory.Label; classLabel.SizeToFit(); classLabel.TextContainer.LineBreakMode = UILineBreakMode.TailTruncation; classLabel.TextContainer.MaximumNumberOfLines = Constants.SidebarClassLabelMaxLines; classLabel.Frame = new CGRect(Constants.ColourButtonSize + Constants.CellTextXOffset, Constants.TableRowHeight / 2 - classLabel.Frame.Height / 2, Constants.ClassLabelWidth, classLabel.Frame.Height + Constants.SidebarClassLabelHeightPadding); // maintain state of checkmarks foreach (var checkBoxState in CheckboxState.ToList()) { if (!checkBoxState.Key.Equals(classCategory)) { continue; } if (checkBoxState.Value) { TickCheckBox(checkBox); } else { UntickCheckBox(checkBox); } UpdateBoundingBox(classCategory, checkBox); ConfigureSidebarSubtitle(); } // count the quantity for each catagory countText.Text = CountNumObservationOfCategory(classCategory).ToString(CultureInfo.CurrentCulture); //Set the colour picker button colour if previously edited countText.BackgroundColor = Constants.TableTextBackgroundColor; countText.TextColor = Constants.TableTextColor; countText.Font = UIFont.GetPreferredFontForTextStyle(UIFontTextStyle.Body); countText.AdjustsFontForContentSizeCategory = true; countText.SizeToFit(); countText.Frame = new CGRect(Constants.TableRowMargin + Constants.CellCountTextXOffset + Constants.ClassLabelWidth, Constants.TableRowHeight / 2 - countText.Frame.Height / 2, Constants.TableRowWidth / 2, countText.Frame.Height); checkBox.Frame = new CGRect(Constants.TableRowWidth - Constants.ColourButtonSize - Constants.TableRowMargin, Constants.TableRowHeight / 2 - Constants.ColourButtonSize / 2, Constants.ColourButtonSize, Constants.ColourButtonSize); checkBox.Layer.CornerRadius = Constants.ColourButtonSize / 2; checkBox.Layer.BorderWidth = Constants.CheckboxBorderWidth; checkBox.TouchUpInside += (sender, e) => { var categoryCount = DisplayItems.Count(); // Count number of classes that has been toggled during switch button change if (SelectedClassCount >= 0 && SelectedClassCount <= categoryCount) { // The checkbox is checked if (checkBox.CurrentBackgroundImage == null) { TickCheckBox(checkBox); SelectedClassCount++; } // The checkbox is not checked else { UntickCheckBox(checkBox); SelectedClassCount--; } } ConfigureSidebarSubtitle(); UpdateBoundingBox(classCategory, checkBox); }; cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.AddSubview(classLabel); cell.AddSubview(countText); cell.AddSubview(colourButton); cell.AddSubview(checkBox); ConfigureCellAccessibility(cell); }
/// <summary> /// Calls when view are loaded /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); // Create toolbar, title label and buttons var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin; toolBar.BarStyle = UIBarStyle.Black; var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.TextColor = UIColor.White; toolBarTitle.Font = UIFont.SystemFontOfSize(18.0f); toolBarTitle.Text = "Bookmarks".t(); var btnAddBookmark = new UIButton(new RectangleF(5, 5, 30, 30)); btnAddBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkAdd32.png"), UIControlState.Normal); btnAddBookmark.TouchUpInside += delegate { SetEditingMode(UITableViewCellEditingStyle.Insert); }; var btnDeleteBookmark = new UIButton(new RectangleF(43, 5, 30, 30)); btnDeleteBookmark.SetImage(UIImage.FromFile("Images/Toolbar/BookmarkDelete32.png"), UIControlState.Normal); btnDeleteBookmark.TouchUpInside += delegate { SetEditingMode(UITableViewCellEditingStyle.Delete); }; toolBar.AddSubview(toolBarTitle); toolBar.AddSubview(btnAddBookmark); toolBar.AddSubview(btnDeleteBookmark); View.AddSubview(toolBar); // Create bookmarks table mBookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain); mBookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; mBookmarksTable.RowHeight = 55; mBookmarksTable.Source = new DataSource(this); View.AddSubview(mBookmarksTable); // Create bookmark cell and text field mNewBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null); mNewBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin; mNewBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55); mNewBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31)); mNewBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; mNewBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect; mNewBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f); mNewBookmarkCell.AddSubview(mNewBookmarkNameTxt); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { if (indexPath.Row < Parent.GroupEntries.Count) { GroupCell cell = tableView.DequeueReusableCell(GroupCell.Identifier) as GroupCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new GroupCell(UITableViewCellStyle.Default, GroupCell.Identifier); cell.TableSource = this; // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height); // remove the selection highlight cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); } // if it's the group nearest the user, color it different. (we always sort by distance) if (SelectedIndex == indexPath.Row) { cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color); } else { cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); } cell.RowIndex = indexPath.Row; // Create the title cell.Title.Text = Parent.GroupEntries[indexPath.Row].Name; cell.Title.SizeToFit( ); // Meeting time - If it isn't set, just blank it out and we wont' show anything for that row. if (string.IsNullOrEmpty(Parent.GroupEntries[indexPath.Row].MeetingTime) == false) { cell.MeetingTime.Text = Parent.GroupEntries[indexPath.Row].MeetingTime; } else { cell.MeetingTime.Text = ConnectStrings.GroupFinder_ContactForTime; } cell.MeetingTime.SizeToFit( ); // Distance cell.Distance.Text = string.Format("{0:##.0} {1}", Parent.GroupEntries[indexPath.Row].DistanceFromSource, ConnectStrings.GroupFinder_MilesSuffix); if (indexPath.Row == 0) { cell.Distance.Text += " " + ConnectStrings.GroupFinder_ClosestTag; } cell.Distance.SizeToFit( ); // Childcare and Young Adults cell.Filters.Text = string.Empty; if (string.IsNullOrWhiteSpace(Parent.GroupEntries[indexPath.Row].Filters) == false) { if (Parent.GroupEntries[indexPath.Row].Filters.Contains(PrivateConnectConfig.GroupFinder_Childcare_Filter)) { cell.Filters.Text = ConnectStrings.GroupFinder_OffersChildcare; } if (Parent.GroupEntries[indexPath.Row].Filters.Contains(PrivateConnectConfig.GroupFinder_YoungAdults_Filter)) { if (cell.Filters.Text.Length > 0) { cell.Filters.Text += ", "; } cell.Filters.Text += ConnectStrings.GroupFinder_YoungAdults; } } cell.Filters.SizeToFit( ); // pick a nice magic number for the cell height PendingCellHeight = 105.0f; // first, always put the title at the top cell.Title.Frame = new CGRect(10, 1, cell.Frame.Width - 55, cell.Title.Frame.Height + 5); cell.MeetingTime.Frame = new CGRect(10, cell.Title.Frame.Bottom, cell.Frame.Width - 5, cell.MeetingTime.Frame.Height); cell.Distance.Frame = new CGRect(10, cell.MeetingTime.Frame.Bottom, cell.Frame.Width - 5, cell.Distance.Frame.Height); cell.Filters.Frame = new CGRect(10, cell.Distance.Frame.Bottom, cell.Frame.Width - 5, cell.Distance.Frame.Height); cell.Seperator.Frame = new CGRect(0, PendingCellHeight - 1, cell.Bounds.Width, 1); cell.JoinButton.Frame = new CGRect(cell.Bounds.Width - cell.JoinButton.Bounds.Width, (PendingCellHeight - cell.JoinButton.Bounds.Height) / 2, cell.JoinButton.Bounds.Width, cell.JoinButton.Bounds.Height); return(cell); } else if (indexPath.Row == Parent.GroupEntries.Count) { // the last row should act as a "get more groups" button // simply create a dummy cell that acts as padding UITableViewCell cell = tableView.DequeueReusableCell("10_more") as GroupCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "10_more"); UILabel textLabel = new UILabel( ); textLabel.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Medium_FontSize); textLabel.Layer.AnchorPoint = CGPoint.Empty; textLabel.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor); textLabel.BackgroundColor = UIColor.Clear; textLabel.LineBreakMode = UILineBreakMode.TailTruncation; textLabel.Text = ConnectStrings.GroupFinder_10More; textLabel.TextAlignment = UITextAlignment.Center; cell.AddSubview(textLabel); // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, 44); textLabel.Bounds = cell.Bounds; // remove the selection highlight cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.BackgroundColor = UIColor.Clear; } return(cell); } else { // simply create a dummy cell that acts as padding UITableViewCell cell = tableView.DequeueReusableCell("dummy") as GroupCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "dummy"); // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, 44); // remove the selection highlight cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.BackgroundColor = UIColor.Clear; } return(cell); } }
private UITableViewCell GetButtonCell() { var cell = new UITableViewCell (UITableViewCellStyle.Default, _cellIdentifier); cell.AddSubview (BtnAdd); return cell; }
UITableViewCell CellContentFactoryImplementationForPerson2() { UITableViewCell cc = new UITableViewCell(); UIView uiview_xibless = new UIView(); uiview_xibless.Frame = new RectangleF(0, 0, 750, 44); UIButton btnDelete; UILabel lblName; UILabel lblDate; btnDelete = UIButton.FromType(UIButtonType.Custom); btnDelete.Frame = new RectangleF(30, 8, 100, 27); lblName = new UILabel(new RectangleF(150, 8 + 3, 350, 21)); lblDate = new UILabel(new RectangleF(500, 8 + 3, 150, 21)); //UIControlState = Normal -> default system state for iOS element //UIControlState = Highlighted -> Highlighted state of a control. // A control enters this state when a touch enters and exits // during tracking and when there is a touch up event. btnDelete.SetTitleColor(UIColor.Green, UIControlState.Normal); btnDelete.SetTitleColor(UIColor.Orange, UIControlState.Highlighted); btnDelete.SetTitle("Delete", UIControlState.Normal); btnDelete.TouchUpInside += (object sender, EventArgs e) => { }; lblName.Text = "Name"; lblDate.Text = DateTime.Now.ToString(); UIView[] views = { btnDelete, lblName, lblDate }; uiview_xibless.AddSubviews(views); UIView content_view = uiview_xibless; // wrap UIView cc.Bounds = content_view.Bounds; cc.AddSubview(content_view); return cc; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UIButton button = new UIButton(); // request a recycled cell to save memory UITableViewCell cell = tableView.DequeueReusableCell(identifier); // if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Subtitle, identifier); //Add a button button = new UIButton(new CGRect(cell.Frame.Size.Width - 60, 10, 90, 30)); button.BackgroundColor = UIColor.Clear; button.SetTitleColor(UIColor.FromRGB(3, 151, 215), UIControlState.Normal); button.Layer.CornerRadius = 5; button.Layer.BorderColor = UIColor.FromRGB(3, 151, 215).CGColor; button.Layer.BorderWidth = 1; button.Tag = indexPath.Row; button.TouchUpInside += (object sender, EventArgs e) => { int n = Int32.Parse(((sender as UIButton).Tag).ToString()); if (getSubscribtionStatus(list[n]) == "0") { Sqlite.updateFeed(getValue(list[n]), 1); button.SetTitle("Following", UIControlState.Normal); } else { Sqlite.updateFeed(getValue(list[n]), 0); button.SetTitle("Follow", UIControlState.Normal); } list = Sqlite.getData(false); }; cell.AddSubview(button); } else { Array subviews = cell.Subviews; foreach (UIView v in subviews) { if (v.GetType() == typeof(UIButton)) { button = v as UIButton; button.SetTitle("", UIControlState.Normal); button.Tag = indexPath.Row; } } } cell.TextLabel.Text = "LinkFeed " + (indexPath.Row + 1); cell.DetailTextLabel.Text = getValue(this.list[indexPath.Row]); if (getSubscribtionStatus(list[indexPath.Row]) == "1") { button.SetTitle("Following", UIControlState.Normal); } else { button.SetTitle("Follow", UIControlState.Normal); } return(cell); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var msg = room.Messages [indexPath.Row]; var ret = new UITableViewCell (); var width = UIScreen.MainScreen.Bounds.Width; var l = new UILabel (new RectangleF (0, 0, width, 16)); l.Font = UIFont.BoldSystemFontOfSize (16); l.Text = msg.NickName; var m = new UILabel (new RectangleF (0, 16, width, 32)); m.Text = msg.Text; m.LineBreakMode = UILineBreakMode.CharacterWrap; m.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; ret.AddSubview (l); ret.AddSubview (m); return ret; }
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); }
public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { if (LeftTabbedPage.TabItemTemplate != null) { var cell = LeftTabbedPage.TabItemTemplate.CreateContent() as ViewCellEx; cell.BindingContext = MenuItems[indexPath.Row]; cell.Parent = LeftTabbedPage; var rect = new Rectangle(0, 0, cell.View.WidthRequest, cell.View.HeightRequest); cell.View.Layout(rect); if (Platform.GetRenderer(cell.View) == null) { Platform.SetRenderer(cell.View, Platform.CreateRenderer(cell.View)); } var renderer = Platform.GetRenderer(cell.View); var nativeView = renderer.NativeView; nativeView.AutoresizingMask = UIViewAutoresizing.All; nativeView.ContentMode = UIViewContentMode.ScaleToFill; nativeView.Frame = new CGRect(0, 0, cell.View.WidthRequest, cell.View.HeightRequest); nativeView.SetNeedsLayout(); var nativeCell = new UITableViewCell(); nativeCell.Frame = new CGRect(0, 0, cell.View.WidthRequest, cell.View.HeightRequest); nativeCell.SelectionStyle = UITableViewCellSelectionStyle.None; foreach (var subView in nativeCell.ContentView.Subviews) { subView.RemoveFromSuperview(); } nativeCell.AddSubview(nativeView); return(nativeCell); } else { var cell = tableView.DequeueReusableCell(UIVerticalTabbarViewCell.Key); cell.SelectionStyle = UITableViewCellSelectionStyle.None; var item = MenuItems[indexPath.Row]; if (cell is UIVerticalTabbarViewCell verticalTabbarViewCell) { verticalTabbarViewCell.TitleView.Text = item.Title; // verticalTabbarViewCell.IconView.Image = new UIImage(item.Icon).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); var imageSource = item.IconImageSource; if (imageSource is FileImageSource fileImageSource) { var fileImageSOurceHandler = new FileImageSourceHandler(); var image = fileImageSOurceHandler.LoadImageAsync(imageSource).Result; if (image != null) { verticalTabbarViewCell.IconView.Image = image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); } } if (indexPath.Row == 0) { verticalTabbarViewCell.TitleView.TextColor = UIColor.Orange; verticalTabbarViewCell.IconView.TintColor = UIColor.Orange; } else { verticalTabbarViewCell.TitleView.TextColor = UIColor.Gray; verticalTabbarViewCell.IconView.TintColor = UIColor.Gray; } } return(cell); } }
public override void ViewDidLoad() { base.ViewDidLoad(); var btnAddBookmark = new UIBarButtonItem(); btnAddBookmark.Image = UIImage.FromFile("add.png"); btnAddBookmark.Clicked += delegate { setEditMode(UITableViewCellEditingStyle.Insert); }; var btnDeleteBookmark = new UIBarButtonItem(); btnDeleteBookmark.Image = UIImage.FromFile("delete.png"); btnDeleteBookmark.Clicked += delegate { setEditMode(UITableViewCellEditingStyle.Delete); }; var btnClose = new UIBarButtonItem(); btnClose.Image = UIImage.FromFile("close.png"); btnClose.Clicked += delegate { DismissViewController(true, null); }; var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; toolBarTitle.BackgroundColor = UIColor.Clear; toolBarTitle.TextColor = UIColor.White; toolBarTitle.TextAlignment = UITextAlignment.Center; toolBarTitle.Text = "Bookmarks".t(); var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44)); toolBar.BarStyle = UIBarStyle.Black; toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin |UIViewAutoresizing.FlexibleWidth; toolBar.SetItems(new [] { btnAddBookmark, btnDeleteBookmark, space, btnClose }, false); toolBar.AddSubview(toolBarTitle); View.AddSubview(toolBar); _bookmarksTable = new UITableView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height), UITableViewStyle.Plain); _bookmarksTable.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; _bookmarksTable.Source = new DataSource(this); View.AddSubview(_bookmarksTable); _newBookmarkCell = new UITableViewCell(UITableViewCellStyle.Default, null); _newBookmarkCell.AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin; _newBookmarkCell.Frame = new RectangleF(0, 0, View.Bounds.Width, 55); _newBookmarkNameTxt = new UITextField(new RectangleF(40, 12, View.Bounds.Width - 45, 31)); _newBookmarkNameTxt.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _newBookmarkNameTxt.BorderStyle = UITextBorderStyle.RoundedRect; _newBookmarkNameTxt.Font = UIFont.SystemFontOfSize(16.0f); _newBookmarkCell.AddSubview(_newBookmarkNameTxt); }
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; }