Skip to content

Custom Dialog Controllers

Josh Oldenburg edited this page Jun 25, 2014 · 2 revisions

The use of a custom dialog controller is a very simple and effective way to have full control on how your dialog is displayed. To do this, simply create a subclass of the QuickDialogController class. Using this subclass, you can change the appearance and behavior of the table view, and implement custom actions for elements.

Instead of directly creating your custom controller objects, though, the QRootElement object can be told which controller to use, and it will automatically create controllers of that type as needed. So, for example, if you have a new class of type MyDialogController that is a subclass of QuickDialogController, you can define the root as follows:

QRootElement *root = [[QRootElement alloc] init];
root.controllerName = @"MyDialogController";

root.title = @"Hello World";
// Create the rest of the root element here

MyDialogController *myDialogController = (MyDialogController *)[QuickDialogController controllerForRoot:root];
[self presentModalViewController:navigation animated:YES];

The controller, and all the controllers necessary to display that root element, will automatically be of the type you defined!

Clone this wiki locally