Permalink
Browse files

Merge branch 'master' of https://github.com/escoz/QuickDialog

  • Loading branch information...
2 parents 12d241a + c809e54 commit 1b4774b5ea431c1e03ae1d4a25dbbe6d20c7cbff @tobiasbayer committed Apr 8, 2012
@@ -138,11 +138,20 @@
D8F180E813F0599A009B0CC6 /* QTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = D8F180E813F0599A009B0CC5 /* QTableViewCell.h */; };
D8F180E813F0599A009B0CC8 /* NSMutableArray+MoveObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D8F180E813F0599A009B0CC7 /* NSMutableArray+MoveObject.m */; };
D8F180E813F0599A009B0CCA /* NSMutableArray+MoveObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D8F180E813F0599A009B0CC9 /* NSMutableArray+MoveObject.h */; };
- D8F180E813F0599A009B0CCC /* QPickerElement.m in Sources */ = {isa = PBXBuildFile; fileRef = D8F180E813F0599A009B0CCB /* QPickerElement.m */; };
- D8F180E813F0599A009B0CCE /* QPickerElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D8F180E813F0599A009B0CCD /* QPickerElement.h */; };
D8F180E813F0599A009B0CD0 /* jsonremote.json in Resources */ = {isa = PBXBuildFile; fileRef = D8F180E813F0599A009B0CCF /* jsonremote.json */; };
D8F180E813F0599A009B0CD2 /* QuickDialogWebController.m in Sources */ = {isa = PBXBuildFile; fileRef = D8F180E813F0599A009B0CD1 /* QuickDialogWebController.m */; };
D8F180E813F0599A009B0CD4 /* QuickDialogWebController.h in Headers */ = {isa = PBXBuildFile; fileRef = D8F180E813F0599A009B0CD3 /* QuickDialogWebController.h */; };
+ F2E6149E151C9E4D00F36976 /* QSelectSection.h in Headers */ = {isa = PBXBuildFile; fileRef = F2E6149C151C9E4D00F36976 /* QSelectSection.h */; };
+ F2E6149F151C9E4D00F36976 /* QSelectSection.m in Sources */ = {isa = PBXBuildFile; fileRef = F2E6149D151C9E4D00F36976 /* QSelectSection.m */; };
+ F2E614A2151CA1A100F36976 /* QSelectItemElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F2E614A0151CA1A100F36976 /* QSelectItemElement.h */; };
+ F2E614A3151CA1A100F36976 /* QSelectItemElement.m in Sources */ = {isa = PBXBuildFile; fileRef = F2E614A1151CA1A100F36976 /* QSelectItemElement.m */; };
+ F2F23A20152DD48B00EB6685 /* QPickerElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F2F23A19152DD48B00EB6685 /* QPickerElement.h */; };
+ F2F23A21152DD48B00EB6685 /* QPickerElement.m in Sources */ = {isa = PBXBuildFile; fileRef = F2F23A1A152DD48B00EB6685 /* QPickerElement.m */; };
+ F2F23A22152DD48B00EB6685 /* QPickerTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = F2F23A1B152DD48B00EB6685 /* QPickerTableViewCell.h */; };
+ F2F23A23152DD48B00EB6685 /* QPickerTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F2F23A1C152DD48B00EB6685 /* QPickerTableViewCell.m */; };
+ F2F23A24152DD48B00EB6685 /* QPickerValueParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F2F23A1D152DD48B00EB6685 /* QPickerValueParser.h */; };
+ F2F23A25152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F2F23A1E152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.h */; };
+ F2F23A26152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F2F23A1F152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -301,11 +310,20 @@
D8F180E813F0599A009B0CC5 /* QTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QTableViewCell.h; path = quickdialog/QTableViewCell.h; sourceTree = SOURCE_ROOT; };
D8F180E813F0599A009B0CC7 /* NSMutableArray+MoveObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSMutableArray+MoveObject.m"; path = "quickdialog/NSMutableArray+MoveObject.m"; sourceTree = SOURCE_ROOT; };
D8F180E813F0599A009B0CC9 /* NSMutableArray+MoveObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+MoveObject.h"; path = "quickdialog/NSMutableArray+MoveObject.h"; sourceTree = SOURCE_ROOT; };
- D8F180E813F0599A009B0CCB /* QPickerElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QPickerElement.m; path = quickdialog/QPickerElement.m; sourceTree = "<group>"; };
- D8F180E813F0599A009B0CCD /* QPickerElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QPickerElement.h; path = quickdialog/QPickerElement.h; sourceTree = "<group>"; };
D8F180E813F0599A009B0CCF /* jsonremote.json */ = {isa = PBXFileReference; lastKnownFileType = file.json; name = jsonremote.json; path = sample/Resources/jsonremote.json; sourceTree = SOURCE_ROOT; };
D8F180E813F0599A009B0CD1 /* QuickDialogWebController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QuickDialogWebController.m; path = quickdialog/QuickDialogWebController.m; sourceTree = SOURCE_ROOT; };
D8F180E813F0599A009B0CD3 /* QuickDialogWebController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuickDialogWebController.h; path = quickdialog/QuickDialogWebController.h; sourceTree = SOURCE_ROOT; };
+ F2E6149C151C9E4D00F36976 /* QSelectSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QSelectSection.h; path = quickdialog/QSelectSection.h; sourceTree = SOURCE_ROOT; };
+ F2E6149D151C9E4D00F36976 /* QSelectSection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QSelectSection.m; path = quickdialog/QSelectSection.m; sourceTree = SOURCE_ROOT; };
+ F2E614A0151CA1A100F36976 /* QSelectItemElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QSelectItemElement.h; path = quickdialog/QSelectItemElement.h; sourceTree = SOURCE_ROOT; };
+ F2E614A1151CA1A100F36976 /* QSelectItemElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QSelectItemElement.m; path = quickdialog/QSelectItemElement.m; sourceTree = SOURCE_ROOT; };
+ F2F23A19152DD48B00EB6685 /* QPickerElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QPickerElement.h; path = quickdialog/QPickerElement.h; sourceTree = SOURCE_ROOT; };
+ F2F23A1A152DD48B00EB6685 /* QPickerElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QPickerElement.m; path = quickdialog/QPickerElement.m; sourceTree = SOURCE_ROOT; };
+ F2F23A1B152DD48B00EB6685 /* QPickerTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QPickerTableViewCell.h; path = quickdialog/QPickerTableViewCell.h; sourceTree = SOURCE_ROOT; };
+ F2F23A1C152DD48B00EB6685 /* QPickerTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QPickerTableViewCell.m; path = quickdialog/QPickerTableViewCell.m; sourceTree = SOURCE_ROOT; };
+ F2F23A1D152DD48B00EB6685 /* QPickerValueParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QPickerValueParser.h; path = quickdialog/QPickerValueParser.h; sourceTree = SOURCE_ROOT; };
+ F2F23A1E152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QPickerWhitespaceDelimitedStringParser.h; path = quickdialog/QPickerWhitespaceDelimitedStringParser.h; sourceTree = SOURCE_ROOT; };
+ F2F23A1F152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QPickerWhitespaceDelimitedStringParser.m; path = quickdialog/QPickerWhitespaceDelimitedStringParser.m; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -345,8 +363,6 @@
D80B0E2813E052DF00FA85CA = {
isa = PBXGroup;
children = (
- D8F180E813F0599A009B0CCD /* QPickerElement.h */,
- D8F180E813F0599A009B0CCB /* QPickerElement.m */,
2CE450A8145ADF8000B77D0E /* libQuickDialog */,
D860356713E0534000CB1785 /* quickdialog */,
D80B0E3D13E052DF00FA85CA /* sample */,
@@ -447,6 +463,7 @@
D860356713E0534000CB1785 /* quickdialog */ = {
isa = PBXGroup;
children = (
+ F2F23A12152DD45100EB6685 /* QPickerElement */,
D8F180E813F0599A009B0CD3 /* QuickDialogWebController.h */,
D8F180E813F0599A009B0CD1 /* QuickDialogWebController.m */,
D8B394681514E8B3008ECB34 /* QSegmentedElement.m */,
@@ -531,6 +548,10 @@
D811F8B113EC905B00E3922B /* QRadioItemElement.m */,
D811F8B213EC905B00E3922B /* QRadioSection.h */,
D811F8B313EC905B00E3922B /* QRadioSection.m */,
+ F2E6149C151C9E4D00F36976 /* QSelectSection.h */,
+ F2E6149D151C9E4D00F36976 /* QSelectSection.m */,
+ F2E614A0151CA1A100F36976 /* QSelectItemElement.h */,
+ F2E614A1151CA1A100F36976 /* QSelectItemElement.m */,
D811F8B413EC905B00E3922B /* QRootElement.h */,
D811F8B513EC905B00E3922B /* QRootElement.m */,
D871018414BB3D7A00156D9D /* QRootElement+Builder.h */,
@@ -566,6 +587,20 @@
name = json;
sourceTree = "<group>";
};
+ F2F23A12152DD45100EB6685 /* QPickerElement */ = {
+ isa = PBXGroup;
+ children = (
+ F2F23A19152DD48B00EB6685 /* QPickerElement.h */,
+ F2F23A1A152DD48B00EB6685 /* QPickerElement.m */,
+ F2F23A1B152DD48B00EB6685 /* QPickerTableViewCell.h */,
+ F2F23A1C152DD48B00EB6685 /* QPickerTableViewCell.m */,
+ F2F23A1D152DD48B00EB6685 /* QPickerValueParser.h */,
+ F2F23A1E152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.h */,
+ F2F23A1F152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.m */,
+ );
+ name = QPickerElement;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -623,8 +658,13 @@
D8B39452151394E1008ECB34 /* QMultilineElement.h in Headers */,
D8B39455151394E1008ECB34 /* QMultilineTextViewController.h in Headers */,
D8B394691514E8B3008ECB34 /* QSegmentedElement.h in Headers */,
- D8F180E813F0599A009B0CCE /* QPickerElement.h in Headers */,
D8F180E813F0599A009B0CD4 /* QuickDialogWebController.h in Headers */,
+ F2E6149E151C9E4D00F36976 /* QSelectSection.h in Headers */,
+ F2E614A2151CA1A100F36976 /* QSelectItemElement.h in Headers */,
+ F2F23A20152DD48B00EB6685 /* QPickerElement.h in Headers */,
+ F2F23A22152DD48B00EB6685 /* QPickerTableViewCell.h in Headers */,
+ F2F23A24152DD48B00EB6685 /* QPickerValueParser.h in Headers */,
+ F2F23A25152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -774,8 +814,12 @@
D8B39453151394E1008ECB34 /* QMultilineElement.m in Sources */,
D8B39456151394E1008ECB34 /* QMultilineTextViewController.m in Sources */,
D8B3946A1514E8B3008ECB34 /* QSegmentedElement.m in Sources */,
- D8F180E813F0599A009B0CCC /* QPickerElement.m in Sources */,
D8F180E813F0599A009B0CD2 /* QuickDialogWebController.m in Sources */,
+ F2E6149F151C9E4D00F36976 /* QSelectSection.m in Sources */,
+ F2E614A3151CA1A100F36976 /* QSelectItemElement.m in Sources */,
+ F2F23A21152DD48B00EB6685 /* QPickerElement.m in Sources */,
+ F2F23A23152DD48B00EB6685 /* QPickerTableViewCell.m in Sources */,
+ F2F23A26152DD48B00EB6685 /* QPickerWhitespaceDelimitedStringParser.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -69,7 +69,7 @@ - (QEntryTableViewCell *)init {
}
- (CGRect)calculateFrameForEntryElement {
- int extra = (self.textField.clearButtonMode == UITextFieldViewModeNever) ? 10 :0;
+ int extra = (self.textField.clearButtonMode == UITextFieldViewModeNever) ? 15 :10;
if (_entryElement.title == NULL && _entryElement.image==NULL) {
return CGRectMake(10,10,self.contentView.frame.size.width-10-extra, self.frame.size.height-20);
}
@@ -146,6 +146,7 @@ -(void)recalculateEntryFieldPosition {
- (void)prepareForReuse {
_quickformTableView = nil;
_entryElement = nil;
+ _textField.textAlignment = UITextAlignmentLeft;
}
- (void)textFieldEditingChanged:(UITextField *)textFieldEditingChanged {
@@ -201,7 +202,7 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField {
}
if(_entryElement && _entryElement.delegate && [_entryElement.delegate respondsToSelector:@selector(QEntryShouldReturnForElement:andCell:)]){
- [_entryElement.delegate QEntryShouldReturnForElement:_entryElement andCell:self];
+ return [_entryElement.delegate QEntryShouldReturnForElement:_entryElement andCell:self];
}
return YES;
@@ -100,7 +100,7 @@ - (void)setResizeWhenKeyboardPresented:(BOOL)observesKeyboard {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resizeForKeyboard:) name:UIKeyboardWillHideNotification object:nil];
} else {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
}
}
}
@@ -1,5 +1,18 @@
#import <Foundation/Foundation.h>
+#import "QEntryElement.h"
+#import "QPickerValueParser.h"
+@interface QPickerElement : QEntryElement
+{
+@protected
+ id<QPickerValueParser> _valueParser;
+}
+
+@property (nonatomic, strong) id<QPickerValueParser> valueParser;
+@property (nonatomic, copy) void (^onValueChanged)(void);
+
+@property(nonatomic, strong) NSArray *items;
+
+- (QPickerElement *)initWithTitle:(NSString *)title items:(NSArray *)items value:(NSString *)value;
-@interface QPickerElement : QRadioElement
@end
@@ -1,22 +1,52 @@
#import "QPickerElement.h"
-
+#import "QPickerTableViewCell.h"
+#import "QPickerWhitespaceDelimitedStringParser.h"
@implementation QPickerElement
-
-- (void)createElements {
- // nil
+{
+@private
+ NSArray *_items;
+ void (^_onValueChanged)();
}
-- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller {
- UITableViewCell *const cell = [super getCellForTableView:tableView controller:controller];
- cell.accessoryType = UITableViewCellAccessoryNone;
- return cell;
+@synthesize items = _items;
+@synthesize valueParser = _valueParser;
+@synthesize onValueChanged = _onValueChanged;
+
+-(QPickerElement *)init {
+ self = [super init];
+ self.valueParser = [QPickerWhitespaceDelimitedStringParser new];
+ return self;
}
-- (void)selected:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller indexPath:(NSIndexPath *)indexPath {
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
+- (QPickerElement *)initWithTitle:(NSString *)title items:(NSArray *)items value:(NSString *)value
+{
+ if ((self = [super initWithTitle:title Value:value])) {
+ _items = items;
+ self.valueParser = [QPickerWhitespaceDelimitedStringParser new];
+ }
+ return self;
}
+- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller
+{
+ QPickerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:QPickerTableViewCellIdentifier];
+ if (cell == nil) {
+ cell = [[QPickerTableViewCell alloc] init];
+ }
+
+ [cell prepareForElement:self inTableView:tableView];
+ cell.imageView.image = self.image;
+
+ return cell;
+}
+
+- (void)fetchValueIntoObject:(id)obj
+{
+ if (_key != nil) {
+ [obj setValue:_value forKey:_key];
+ }
+}
@end
@@ -0,0 +1,19 @@
+//
+// QPickerTableViewCell.h
+// QuickDialog
+//
+// Created by HiveHicks on 05.04.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "QEntryTableViewCell.h"
+
+NSString * const QPickerTableViewCellIdentifier;
+
+@interface QPickerTableViewCell : QEntryTableViewCell <UIPickerViewDataSource, UIPickerViewDelegate>
+{
+ UIPickerView *_pickerView;
+}
+
+@property (nonatomic, strong) UIPickerView *pickerView;
+@end
Oops, something went wrong.

0 comments on commit 1b4774b

Please sign in to comment.