0

I am building a form with QuickDialog library in iOS. Here it is possible to insert any QElement at an index into any QSection dynamically with this method

- (void)insertElement:(QElement *)element atIndex:(NSUInteger)index; 

But I found no way to insert a QSection into my QRootElement at runtime. Is there any way I can do that ?

ayon
  • 2,180
  • 2
  • 17
  • 32

1 Answers1

1

There are two ways to you do this:

You can either use the - (void)addSection:(QSection *)section; method on the QRootElement to add the section to the bottom of the root, or you can insert the item directly in the sections mutable array property of the rootElement.

We should probably add a insertSection:atIndex: method for consistency, but it doesn't exist today.

Eduardo Scoz
  • 24,653
  • 6
  • 47
  • 62
  • Great to see you in my question here :) . I checked the above methods available before posting my question here. In both ways, new section will be added at the bottom of the root. But my case is a bit different, I have another 2 sections under a QRadioSection , I have to add new Section when user selects a particular option on that QRadioSection and I also have to remove it and add some other when other options are being selected. I guess, I have to remove the bottom 2 sections , add my required section and then add the deleted 2 sections again if I want to do it like this. – ayon Mar 31 '14 at 06:22
  • As I get you here, I would like to ask another question. Can I add a custom UITableViewCell in my QuickDialog form ? If It can be done, can you please give me some hint, link or sample code so that I can understand and do it ? Thank you so much for your help. – ayon Mar 31 '14 at 06:28
  • you should be able to do `[root.sections insertObject:item atIndex:5]` to insert a new section between existing ones. – Eduardo Scoz Mar 31 '14 at 17:52