1

I'm trying to employ QuickDialog for an iOS 5 iPad app which uses storyboards, but I guess the question would broadly apply to UITableViewController as well.

My understanding is that when I'm initialising the QRootElement, the tableview that QDC creates will replace the view of my class, thus rendering ineffective anything I customise in the IB storyboard. I would like to be able to design the UI in IB, and have the QD table show up as a frame instead of taking over the whole screen.

I think the solution is to have the QuickDialog tableview set up as a subview of my UIView-based class. Is this correct? What would be the best way to achieve this? Would I have to rewrite the root initialiser in my custom view controller that inherits from QDC, or is there a different way, perhaps something like the approach used here?

Thanks!

lucianf
  • 547
  • 7
  • 17

1 Answers1

2

I would recommend you inherit from the QuickDialogViewController as your main controller. The QDViewController inherits directly from UIViewController (instead of UITableViewController), so it's quite easy to just move the table view around and add controls around it.

If you really want to create everything from Interface Builder, your tableview will have to inherit from QuickdialogTableView, and you'll have to provide the delegate and data source yourself. Look at the QDViewController for that, as you'll have to write pretty much the same code.

Eduardo Scoz
  • 24,653
  • 6
  • 47
  • 62
  • 1
    Er, you've mentioned QDViewController in your reply to git issue 68 too, but there isn't such a class, do you actually mean QuickDialogController? – lucianf May 28 '12 at 17:31
  • Cool, thanks. Now, would you care to expand a bit on the inheritance story? I'm quite new to that so I couldn't follow it all the way. My VC inherits from QDC; and, in QDC, the view creation (self.view=self.qdtview) takes place in loadView. But, in order for my storyboard-based view to display correctly, loadView must not be overriden (otherwise, I would have to alloc self.view myself as a blank object and I would lose all the objects assigned in Interface Builder). How can I do the override in my vc in order to keep the view that originates from IB and only add the qtview as a subview? – lucianf May 28 '12 at 17:53
  • Hm, I'm thinking what I need in my VC is to un-override loadView, so that the override in QDC doesn't run anymore, and then create the subView in another method that I can override (perhaps initWithCoder?). Is this correct? If so, how can I un-override a method, or can I somehow call the superclass's [super loadView]? – lucianf May 28 '12 at 18:03
  • I don't really like storyboards or IB to be honest. It's so easy to create UI in code, it's kind of a waste of time to play with drag-and-drop.. – Eduardo Scoz May 28 '12 at 18:23
  • I don't think storyboard calls loadView though, it just implements initWithCoder/initWithNib(don't remember the correct name). If you just override loadView and rewrite it, using the tableView that already exists, things should work correctly. I haven't done it though, so good luck :) – Eduardo Scoz May 28 '12 at 18:25
  • Thanks Eduardo, what I did in the end was to comment out loadView in QD and wrote my own overload which does the same, but by placing the quickDialogTableView as a subview rather than replacing self.view. – lucianf Jun 01 '12 at 12:45
  • @lucianf you don't need to comment out the loadView, simply override it on your code and don't call [super loadView]. I do this as well when I need to put more controls in the same screen. Glad it worked for you. – Eduardo Scoz Jun 01 '12 at 14:04