Skip to content

Commit ca01d51

Browse files
author
Stef Geelen
committed
Merge branch 'smartschool_backport'
2 parents 3d59043 + 2bde0cf commit ca01d51

File tree

4 files changed

+58
-33
lines changed

4 files changed

+58
-33
lines changed

QuickDialog.podspec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Pod::Spec.new do |s|
1313
'and efficient, you can create forms with multiple text fields, or with ' \
1414
'thousands of items with no sweat!'
1515

16+
s.source_files = 'quickdialog', 'extras', '*.{h,m}'
1617
s.requires_arc = true
1718
s.default_subspec = "Core"
1819

@@ -21,9 +22,12 @@ Pod::Spec.new do |s|
2122
end
2223

2324
s.subspec "Extras" do |sp|
24-
sp.dependency 'QuickDialog/Core'
2525
sp.source_files = 'extras', '*.{h,m}'
2626
end
2727

28-
28+
s.prefix_header_contents = <<-EOS
29+
#ifdef __OBJC__
30+
#import "QuickDialog.h"
31+
#endif
32+
EOS
2933
end

extras/QPickerTableViewCell.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#import "QEntryTableViewCell.h"
1010

11+
extern NSString * const QPickerTableViewCellIdentifier;
12+
1113
@interface QPickerTableViewCell : QEntryTableViewCell <UIPickerViewDataSource, UIPickerViewDelegate>
1214
{
1315
UIPickerView *_pickerView;

quickdialog/QBooleanElement.m

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//
1+
//
22
// Copyright 2011 ESCOZ Inc - http://escoz.com
3-
//
4-
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5-
// file except in compliance with the License. You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5+
// file except in compliance with the License. You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
99
// Unless required by applicable law or agreed to in writing, software distributed under
10-
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
10+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
// ANY KIND, either express or implied. See the License for the specific language governing
1212
// permissions and limitations under the License.
1313
//
@@ -100,12 +100,19 @@ - (void)selected:(QuickDialogTableView *)tableView controller:(QuickDialogContro
100100
- (void)buttonPressed:(UIButton *)boolButton {
101101
self.boolValue = !boolButton.selected;
102102
boolButton.selected = _boolValue;
103-
[self performAccessoryAction];
103+
if (_controller!=nil && self.controllerAccessoryAction!=nil) {
104+
SEL selector = NSSelectorFromString(self.controllerAccessoryAction);
105+
if ([_controller respondsToSelector:selector]) {
106+
[(id)_controller performSelector:selector withObject:_controller];
107+
} else {
108+
NSLog(@"No method '%@' was found on controller %@", self.controllerAccessoryAction, [_controller class]);
109+
}
110+
}
104111
}
105112

106113
-(void)setBoolValue:(BOOL)boolValue {
107114
_boolValue = boolValue;
108-
115+
109116
[self handleEditingChanged];
110117
}
111118

@@ -117,8 +124,8 @@ - (void)switched:(id)boolSwitch {
117124
}
118125

119126
- (void)fetchValueIntoObject:(id)obj {
120-
if (_key==nil)
121-
return;
127+
if (_key==nil)
128+
return;
122129
[obj setValue:[NSNumber numberWithBool:self.boolValue] forKey:_key];
123130
}
124131

quickdialog/QElement.m

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//
1+
//
22
// Copyright 2011 ESCOZ Inc - http://escoz.com
3-
//
4-
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5-
// file except in compliance with the License. You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5+
// file except in compliance with the License. You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
99
// Unless required by applicable law or agreed to in writing, software distributed under
10-
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
10+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
// ANY KIND, either express or implied. See the License for the specific language governing
1212
// permissions and limitations under the License.
1313
//
@@ -59,14 +59,14 @@ - (QElement *)initWithKey:(NSString *)key {
5959

6060
- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller {
6161
_controller = controller;
62-
62+
6363
QTableViewCell *cell= [self getOrCreateEmptyCell:tableView];
6464

6565
[cell applyAppearanceForElement:self];
6666

67-
cell.textLabel.text = nil;
68-
cell.detailTextLabel.text = nil;
69-
cell.imageView.image = nil;
67+
cell.textLabel.text = nil;
68+
cell.detailTextLabel.text = nil;
69+
cell.imageView.image = nil;
7070
cell.selectionStyle = UITableViewCellSelectionStyleNone;
7171
cell.showsReorderControl = YES;
7272
cell.accessoryView = nil;
@@ -82,17 +82,29 @@ - (QTableViewCell *)getOrCreateEmptyCell:(QuickDialogTableView *)tableView {
8282
return cell;
8383
}
8484

85+
- (void)handleElementSelected:(QuickDialogController *)controller {
86+
if (_onSelected!= nil)
87+
_onSelected();
8588

89+
if (self.controllerAction!=NULL && !controller.quickDialogTableView.editing){
90+
SEL selector = NSSelectorFromString(self.controllerAction);
91+
if ([controller respondsToSelector:selector]) {
92+
[(id)controller performSelector:selector withObject:controller];
93+
} else {
94+
NSLog(@"No method '%@' was found on controller %@", self.controllerAction, [controller class]);
95+
}
96+
}
97+
}
8698

8799
- (void)selectedAccessory:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller indexPath:(NSIndexPath *)indexPath{
88100
if (self.controllerAccessoryAction!=NULL){
89-
SEL selector = NSSelectorFromString(self.controllerAccessoryAction);
90-
if ([controller respondsToSelector:selector]) {
91-
((void (*)(id, SEL, id)) objc_msgSend)(controller, selector, self);
92-
} else {
93-
NSLog(@"No method '%@' was found on controller %@", self.controllerAccessoryAction, [controller class]);
94-
}
101+
SEL selector = NSSelectorFromString(self.controllerAccessoryAction);
102+
if ([controller respondsToSelector:selector]) {
103+
[(id)controller performSelector:selector withObject:controller];
104+
} else {
105+
NSLog(@"No method '%@' was found on controller %@", self.controllerAccessoryAction, [controller class]);
95106
}
107+
}
96108
}
97109

98110
- (void)selected:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller indexPath:(NSIndexPath *)indexPath {
@@ -144,7 +156,7 @@ - (void)performAction
144156
if (self.controllerAction!=NULL){
145157
SEL selector = NSSelectorFromString(self.controllerAction);
146158
if ([_controller respondsToSelector:selector]) {
147-
((void (*)(id, SEL, id)) objc_msgSend)(_controller, selector, self);
159+
((void (*)(id, SEL, id)) objc_msgSend)(_controller, selector, self);
148160
} else {
149161
NSLog(@"No method '%@' was found on controller %@", self.controllerAction, [_controller class]);
150162
}

0 commit comments

Comments
 (0)