public OptionsSelect(KeyValuePair <string, string> item, OptionSelectType type) { Value = item.Value; Type = type; title = new UILabel(); title.Text = item.Key; title.TextColor = UIColor.Black; title.TextAlignment = UITextAlignment.Center; title.Font = UIFont.FromName("Helvetica", 10); AddSubview(title); Layer.BorderWidth = 0.5f; Layer.BorderColor = AppleBlue.CGColor; BackgroundColor = UIColor.White; }
public void AddItems(string title, Dictionary <string, string> items, OptionSelectType type) { OptionsMenuBox box = new OptionsMenuBox(title, items, type); box.AddGestureRecognizer(new UITapGestureRecognizer(OnBoxTap)); AddSubview(box); Boxes.Add(box); box.SelectionChanged += OnSelectionChanged; nfloat x = BoxPadding; nfloat y = Y; nfloat w = Frame.Width - 2 * BoxPadding; nfloat h = box.GetHeight(); box.Frame = new CGRect(x, y, w, h); Y += h + BoxPadding; }
public OptionsMenuBox(string text, Dictionary <string, string> items, OptionSelectType type) { title = new UILabel(); title.Text = text; title.Font = UIFont.FromName("Helvetica", 13); AddSubview(title); title.SizeToFit(); foreach (KeyValuePair <string, string> item in items) { OptionsSelect option = new OptionsSelect(item, type); option.TouchUpInside += OnOptionSelected; AddSubview(option); options.Add(option); } Layer.CornerRadius = 5; BackgroundColor = UIColor.White; }
public void Update(Dictionary <string, string> items, OptionSelectType type) { foreach (UIView subview in Subviews) { if (subview is OptionsSelect) { (subview as OptionsSelect).TouchUpInside -= OnOptionSelected; subview.RemoveFromSuperview(); } } options.Clear(); foreach (KeyValuePair <string, string> item in items) { OptionsSelect option = new OptionsSelect(item, type); option.TouchUpInside += OnOptionSelected; AddSubview(option); options.Add(option); } }
public void UpdateItems(int index, Dictionary <string, string> items, OptionSelectType type) { Boxes[index].Update(items, type); }