Permalink
Browse files

Root elements could be nested

  • Loading branch information...
1 parent 3f7a866 commit d667360ace5cfdb1def7b7640ad75c70a9699642 Dmitry Yakimenko committed Aug 17, 2011
Showing with 35 additions and 0 deletions.
  1. +22 −0 CocoaTouchDialog/CTDRootElement.m
  2. +13 −0 Demo/Classes/RootViewController.m
@@ -1,4 +1,5 @@
#import "CTDRootElement.h"
+#import "CTDViewController.h"
@implementation CTDRootElement
@@ -62,4 +63,25 @@ - (CTDSection *)getAtIndex:(size_t)index
return (CTDSection *)[sections_ objectAtIndex:index];
}
+- (UITableViewCell *)getCell:(UITableView *)view
+{
+ UITableViewCell *cell = [super getCell:view style:UITableViewCellStyleValue1];
+ if (cell)
+ {
+ cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
+ }
+
+ return cell;
+}
+
+- (void)didSelect
+{
+ // TODO: Make this a function in CTDElement
+ CTDViewController *screen = [[CTDViewController alloc] initWithRoot:self];
+ if (screen)
+ {
+ [[self root].viewController.navigationController pushViewController:screen animated:YES];
+ }
+}
+
@end
@@ -10,6 +10,19 @@ + (CTDRootElement *)createElements
CTD_BOOL(@"Airplane Mode", NO)
),
+ CTD_SECTION(@"Nested", nil,
+ CTD_ROOT(@"Nested",
+ CTD_SECTION(nil, nil,
+ CTD_BOOL(@"One more bool", YES),
+ CTD_ROOT(@"Deeper Nested",
+ CTD_SECTION(nil, nil,
+ CTD_BOOL(@"Yet more bool", YES)
+ )
+ )
+ )
+ )
+ ),
+
CTD_SECTION(@"Screen Link", nil,
CTD_SCREENLINK_CLASS_NONIB(@"No NIB", UIViewController),
CTD_SCREENLINK_CLASS(@"With NIB", WebBrowser)

0 comments on commit d667360

Please sign in to comment.