private void InitBasic() { // Some basic rows StyleItem item1 = new StyleItem("Default","",UITableViewCellStyle.Default,UITableViewCellAccessory.None); StyleItem item2 = new StyleItem("Subtitle","Here is more description",UITableViewCellStyle.Subtitle,UITableViewCellAccessory.None); StyleItem item3 = new StyleItem("Value 1 - no accessory","Here is more description",UITableViewCellStyle.Value1,UITableViewCellAccessory.None); StyleItem item4 = new StyleItem("Value 2 - no accessory","Here is more description",UITableViewCellStyle.Value2,UITableViewCellAccessory.None); StyleItem item5 = new StyleItem("Checkmark","",UITableViewCellStyle.Default,UITableViewCellAccessory.Checkmark); StyleItem item6 = new StyleItem("DetailDisclosureButton","",UITableViewCellStyle.Default,UITableViewCellAccessory.DetailDisclosureButton); StyleItem item7 = new StyleItem("DisclosureIndicator","",UITableViewCellStyle.Default,UITableViewCellAccessory.DisclosureIndicator); _items.Add(item1); _items.Add(item2); _items.Add(item3); _items.Add(item4); _items.Add(item5); _items.Add(item6); _items.Add(item7); }
private void InitAdvanced() { // Single image StyleItem item1 = new StyleItem("Image","",UITableViewCellStyle.Default,UITableViewCellAccessory.None); item1.Image = UIImage.FromFile("bulb_on.png"); // // Two images // StyleItem item2 = new StyleItem("Two images","",UITableViewCellStyle.Default,UITableViewCellAccessory.DisclosureIndicator); item2.Image = UIImage.FromFile("bulb_on.png"); // This is the easiest way to set the right image if you don't want to trap it being clicked in the delegate UIImageView imageView = new UIImageView(UIImage.FromFile("bulb_off.png"),UIImage.FromFile("bulb_off.png")); item2.AccessoryView = imageView; // If you want to trap AccessoryButtonTapped in the delegate, you need to use a UIButton UIButton button = UIButton.FromType(UIButtonType.Custom); button.TouchDown += delegate { UITableViewController nextController = new CheckmarkDemoTableController(UITableViewStyle.Grouped); _parentController.NavigationController.PushViewController(nextController,true); }; button.SetBackgroundImage(UIImage.FromFile("bulb_off.png"),UIControlState.Normal); button.SetBackgroundImage(UIImage.FromFile("bulb_off.png"),UIControlState.Selected); button.Frame = new System.Drawing.RectangleF(0,0,26,26); item2.AccessoryView = button; // // Two images + custom control // StyleItem item3 = new StyleItem("","",UITableViewCellStyle.Default,UITableViewCellAccessory.DisclosureIndicator); item3.Image = UIImage.FromFile("bulb_on.png"); UISlider slider = new UISlider(); slider.MaxValue = 100f; slider.Value = 50f; slider.MinValue = 0f; slider.Frame = new RectangleF(50,9,215,23); item3.ContentView = slider; UIImageView imageView1 = new UIImageView(UIImage.FromFile("bulb_off.png"),UIImage.FromFile("bulb_off.png")); item3.AccessoryView = imageView1; // A switcher StyleItem item4 = new StyleItem("Free beer?","",UITableViewCellStyle.Default,UITableViewCellAccessory.None); UISwitch switcher = new UISwitch(); item4.AccessoryView = switcher; _items.Add(item1); _items.Add(item2); _items.Add(item3); _items.Add(item4); }