A quick and simple iOS programming tip today.
If you create, for example, a settings screen using a DialogViewController, typically you will want a back button to the calling screen. Frustratingly, this doesn’t happen by default, and oddly, while there are many workarounds to this on the web, none mention this simple method:
public partial class settings : DialogViewController { public settings () : base (UITableViewStyle.Grouped, null, true) { Root = new RootElement ("Settings") { new Section ("First Section"){ new StringElement ("Hello", () => { new UIAlertView ("Hola", "Thanks for tapping!", null, "Continue").Show ();
}), new EntryElement ("Name", "Enter your name", String.Empty) }, new Section ("Second Section"){ }, }; }
The critical line is this:
public settings () : base (UITableViewStyle.Grouped, null, true)
Simply add “true” as the third argument of the base() call.