Permalink
Browse files

Before and After elements for binding section

  • Loading branch information...
1 parent 1d96bdf commit e80faaee7bfcd52a0c17f2afc406051e1a212164 @escoz committed Aug 29, 2012
Showing with 19 additions and 0 deletions.
  1. +12 −0 quickdialog/QBindingEvaluator.m
  2. +3 −0 quickdialog/QSection.h
  3. +4 −0 quickdialog/QSection.m
@@ -80,11 +80,23 @@ + (BOOL)stringIsEmpty:(NSString *) aString {
- (void)bindSection:(QSection *)section toCollection:(NSArray *)items {
[section.elements removeAllObjects];
+ for (id item in section.beforeTemplateElements){
+ QElement *element = [_builder buildElementWithObject:item];
+ [section addElement:element];
+ [element bindToObject:item];
+ }
+
for (id item in items){
QElement *element = [_builder buildElementWithObject:section.elementTemplate];
[section addElement:element];
[element bindToObject:item];
}
+
+ for (id item in section.afterTemplateElements){
+ QElement *element = [_builder buildElementWithObject:item];
+ [section addElement:element];
+ [element bindToObject:item];
+ }
}
- (void)bindRootElement:(QRootElement *)element toCollection:(NSArray *)items {
View
@@ -37,6 +37,9 @@
@property(nonatomic, retain) NSString *title;
@property(nonatomic, retain) NSString *footer;
@property(nonatomic, retain) NSMutableArray * elements;
+@property(nonatomic, retain) NSMutableArray * beforeTemplateElements;
+@property(nonatomic, retain) NSMutableArray * afterTemplateElements;
+
@property(nonatomic, assign) QRootElement *rootElement;
@property(nonatomic, readonly) BOOL needsEditing;
View
@@ -20,6 +20,8 @@ @implementation QSection {
NSString *_footerImage;
NSDictionary *_elementTemplate;
BOOL _canDeleteRows;
+ NSMutableArray *_afterTemplateElements;
+ NSMutableArray *_beforeTemplateElements;
}
@synthesize title;
@synthesize footer;
@@ -34,6 +36,8 @@ @implementation QSection {
@synthesize footerImage = _footerImage;
@synthesize elementTemplate = _elementTemplate;
@synthesize canDeleteRows = _canDeleteRows;
+@synthesize afterTemplateElements = _afterTemplateElements;
+@synthesize beforeTemplateElements = _beforeTemplateElements;
- (BOOL)needsEditing {

0 comments on commit e80faae

Please sign in to comment.