Skip to content

Instantly share code, notes, and snippets.

@Sunnyztj
Created January 6, 2014 03:06
Show Gist options
  • Save Sunnyztj/8277612 to your computer and use it in GitHub Desktop.
Save Sunnyztj/8277612 to your computer and use it in GitHub Desktop.
QuickDialog add a object to QSelectSection
QSection *sec2 = [[[QSection alloc] initWithTitle:@""] autorelease];
[root addSection:sec2];
QButtonElement *buttonElement1 = [[QButtonElement alloc] initWithTitle:@"Done"];
buttonElement1.key = @"Done";
buttonElement1.onSelected = ^(void) {
NSMutableDictionary* d = [[NSMutableDictionary alloc] init];
[root fetchValueIntoObject:d];
QSelectSection* sec = (QSelectSection*)[self.root sectionWithKey:@"Addresses"];
if ([d objectForKey:@"New Address"]) {
[sec addOption:[d objectForKey:@"New Address"]];
[sec.selectedIndexes addObject:[NSNumber numberWithInt:sec.items.count-1]];
[self.quickDialogTableView reloadData];
}
[self popToPreviousRootElement];
};
[sec2 addElement:buttonElement1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment