ProMotion-XLForm 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -1
- data/lib/ProMotion-XLForm.rb +0 -1
- data/lib/ProMotion/XLForm/xl_form.rb +9 -2
- data/lib/ProMotion/XLForm/xl_form_cell_builder.rb +15 -5
- data/lib/ProMotion/XLForm/xl_form_patch.rb +38 -0
- data/lib/ProMotion/XLForm/xl_form_screen.rb +24 -13
- data/lib/ProMotion/XLForm/xl_form_view_controller.rb +5 -0
- metadata +3 -4
- data/lib/ProMotion/XLForm/cells/xl_form_image_selector_cell.rb +0 -162
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ccbbd4523b880c96a97d116954a4a2f489d25ee
|
4
|
+
data.tar.gz: a3205db9af2f36746e5b8fc9c586f78c9448abcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92da0d7781a60fa052347d026a3b1e0fc885a0f391d7264131543b62d1f75f5c9049a1c78f2202b060bbaab0a7f8683de7a17cc575f2971da6144b3ed11ddaf2
|
7
|
+
data.tar.gz: 28b2e846427d54be79d82e209121a00c5190996cb38daf589431241217c3a56991ba7729dddb7117256c9d5ced9e0736697f2889e7eb9e2f3d14390e6f725234
|
data/README.md
CHANGED
@@ -113,7 +113,8 @@ class TestFormScreen < PM::XLFormScreen
|
|
113
113
|
|
114
114
|
form_options required: :asterisks, # add an asterisk to required fields
|
115
115
|
on_save: :'save_form:', # will be called when you touch save
|
116
|
-
on_cancel: :cancel_form # will be called when you touch cancel
|
116
|
+
on_cancel: :cancel_form, # will be called when you touch cancel
|
117
|
+
auto_focus: true # the form will focus on the first focusable field
|
117
118
|
|
118
119
|
def save_form(values)
|
119
120
|
dismiss_keyboard
|
@@ -170,10 +171,17 @@ You can also get a specific value with `value_for_cell(:my_cell)`.
|
|
170
171
|
female: 'Female',
|
171
172
|
other: 'Other'
|
172
173
|
},
|
174
|
+
# An optional row paramater may be passed |old_value, new_value|
|
173
175
|
on_change: lambda do |old_value, new_value|
|
174
176
|
puts "Changed from #{old_value} to #{new_value}"
|
175
177
|
end
|
176
178
|
}
|
179
|
+
# An optional row paramater may be passed to on_change:
|
180
|
+
# on_change: lambda do |old_value, new_value, row|
|
181
|
+
# puts "Changed from #{old_value} to #{new_value}"
|
182
|
+
# row.setTitle(new_value)
|
183
|
+
# self.reloadFormRow(row) if old_value != new_value
|
184
|
+
# end
|
177
185
|
```
|
178
186
|
|
179
187
|
### Multivalued Sections (Insert, Delete, Reorder rows)
|
@@ -384,6 +392,14 @@ You can change the appearance of the cell using the `appearance` hash
|
|
384
392
|
"value_3" => "Value 3",
|
385
393
|
"value_4" => "Value 4",
|
386
394
|
}
|
395
|
+
},
|
396
|
+
{
|
397
|
+
title: 'Alignment',
|
398
|
+
name: :align,
|
399
|
+
type: :text,
|
400
|
+
appearance: {
|
401
|
+
alignment: :right # or NSTextAlignmentRight
|
402
|
+
}
|
387
403
|
}
|
388
404
|
```
|
389
405
|
|
@@ -397,6 +413,21 @@ You can also pass any key-value to configure your cell. Take a look at [this](ht
|
|
397
413
|
}
|
398
414
|
```
|
399
415
|
|
416
|
+
### Keyboard
|
417
|
+
For the text based cells (like `:text`, `:password`, `:number`, `:integer`, `:decimal`), you can specify a `keyboard_type`. The following keyboard types are available :
|
418
|
+
- :default
|
419
|
+
- :ascii
|
420
|
+
- :numbers_punctuation
|
421
|
+
- :url
|
422
|
+
- :number_pad
|
423
|
+
- :phone_pad
|
424
|
+
- :name_phone_pad
|
425
|
+
- :email
|
426
|
+
- :decimal_pad
|
427
|
+
- :twitter
|
428
|
+
- :web_search
|
429
|
+
- :alphabet
|
430
|
+
|
400
431
|
## Contributing
|
401
432
|
|
402
433
|
1. Fork it
|
data/lib/ProMotion-XLForm.rb
CHANGED
@@ -18,7 +18,6 @@ Motion::Project::App.setup do |app|
|
|
18
18
|
app.files << File.join(lib_dir_path, "ProMotion/XLForm/xl_form_cell_builder.rb")
|
19
19
|
app.files << File.join(lib_dir_path, "ProMotion/XLForm/xl_form_section_builder.rb")
|
20
20
|
app.files << File.join(lib_dir_path, "ProMotion/XLForm/cells/xl_form_cell.rb")
|
21
|
-
app.files << File.join(lib_dir_path, "ProMotion/XLForm/cells/xl_form_image_selector_cell.rb")
|
22
21
|
app.files << File.join(lib_dir_path, "ProMotion/XLForm/cells/xl_form_color_selector_cell.rb")
|
23
22
|
app.files << File.join(lib_dir_path, "ProMotion/XLForm/value_transformer.rb")
|
24
23
|
app.files << File.join(lib_dir_path, "ProMotion/XLForm/validators/validator.rb")
|
@@ -11,12 +11,19 @@ module ProMotion
|
|
11
11
|
@form_data = form_data
|
12
12
|
@title = opts[:title] || ''
|
13
13
|
@required = opts[:required]
|
14
|
+
@auto_focus = opts[:auto_focus]
|
14
15
|
end
|
15
16
|
|
16
17
|
def build
|
17
18
|
form = XLFormDescriptor.formDescriptorWithTitle(@title)
|
18
19
|
form.addAsteriskToRequiredRowsTitle = (@required == :asterisks)
|
19
20
|
|
21
|
+
|
22
|
+
# focus on this cell
|
23
|
+
if @auto_focus
|
24
|
+
form.assignFirstResponderOnShow = true
|
25
|
+
end
|
26
|
+
|
20
27
|
form_data.each do |section_data|
|
21
28
|
section = create_section(section_data)
|
22
29
|
form.addFormSection(section)
|
@@ -79,9 +86,9 @@ module ProMotion
|
|
79
86
|
button: XLFormRowDescriptorTypeButton,
|
80
87
|
info: XLFormRowDescriptorTypeInfo,
|
81
88
|
step_counter: XLFormRowDescriptorTypeStepCounter,
|
82
|
-
image:
|
89
|
+
image: XLFormRowDescriptorTypeImage,
|
83
90
|
color: 'XLFormRowDescriptorTypeColor',
|
84
|
-
}[symbol]
|
91
|
+
}[symbol]
|
85
92
|
end
|
86
93
|
|
87
94
|
end
|
@@ -13,6 +13,8 @@ module ProMotion
|
|
13
13
|
type = :selector_push
|
14
14
|
end
|
15
15
|
|
16
|
+
mp("Can't find the type #{type}, maybe a typo ?", force_color: :red) if row_type(type).nil? && !cell_data[:cell_class]
|
17
|
+
|
16
18
|
cell = XLFormRowDescriptor.formRowDescriptorWithTag(tag, rowType: row_type(type), title: title)
|
17
19
|
|
18
20
|
cell.required = cell_data[:required]
|
@@ -60,11 +62,7 @@ module ProMotion
|
|
60
62
|
|
61
63
|
cell_class = cell_data[:cell_class]
|
62
64
|
|
63
|
-
|
64
|
-
if cell_data[:type] == :image
|
65
|
-
cell_class = XLFormImageSelectorCell if cell_class.nil?
|
66
|
-
cell_data[:height] ||= 100
|
67
|
-
elsif cell_data[:type] == :color
|
65
|
+
if cell_data[:type] == :color
|
68
66
|
cell_class = XLFormColorSelectorCell if cell_class.nil?
|
69
67
|
end
|
70
68
|
|
@@ -159,6 +157,7 @@ module ProMotion
|
|
159
157
|
cell.cellConfig["detailTextLabel.font"] = appearance[:detail_font] if appearance[:detail_font]
|
160
158
|
cell.cellConfig["detailTextLabel.textColor"] = appearance[:detail_color] if appearance[:detail_color]
|
161
159
|
cell.cellConfig["backgroundColor"] = appearance[:background_color] if appearance[:background_color]
|
160
|
+
cell.cellConfig["textField.textAlignment"] = text_alignment(appearance[:alignment]) if appearance[:alignment]
|
162
161
|
|
163
162
|
appearance.delete_if { |k, v| k.is_a?(Symbol) }.each do |k, v|
|
164
163
|
cell.cellConfig[k] = v
|
@@ -187,5 +186,16 @@ module ProMotion
|
|
187
186
|
cell
|
188
187
|
end
|
189
188
|
|
189
|
+
def text_alignment(symbol)
|
190
|
+
{
|
191
|
+
left: NSTextAlignmentLeft,
|
192
|
+
center: NSTextAlignmentCenter,
|
193
|
+
centered: NSTextAlignmentCenter,
|
194
|
+
right: NSTextAlignmentRight,
|
195
|
+
justified: NSTextAlignmentJustified,
|
196
|
+
natural: NSTextAlignmentNatural
|
197
|
+
}[symbol] || symbol || NSTextAlignmentLeft
|
198
|
+
end
|
199
|
+
|
190
200
|
end
|
191
201
|
end
|
@@ -62,11 +62,35 @@ class XLFormRowDescriptor
|
|
62
62
|
if self.cell && self.cell.respond_to?(:setup)
|
63
63
|
self.cell.setup(cell_data, form_controller)
|
64
64
|
end
|
65
|
+
if self.cell.respond_to?(:accessibilityLabel) && cell_data && cell_data[:title]
|
66
|
+
self.cell.accessibilityLabel = cell_data[:title]
|
67
|
+
end
|
68
|
+
if self.cell.respond_to?(:keyboard_type) && cell_data[:keyboard_type]
|
69
|
+
self.cell.keyboard_type = keyboard_type(cell_data[:keyboard_type])
|
70
|
+
end
|
71
|
+
|
65
72
|
self.configureCellAtCreationTime
|
66
73
|
end
|
67
74
|
|
68
75
|
self.cell
|
69
76
|
end
|
77
|
+
|
78
|
+
def keyboard_type(symbol)
|
79
|
+
{
|
80
|
+
default: UIKeyboardTypeDefault,
|
81
|
+
ascii: UIKeyboardTypeASCIICapable,
|
82
|
+
numbers_punctuation: UIKeyboardTypeNumbersAndPunctuation,
|
83
|
+
url: UIKeyboardTypeURL,
|
84
|
+
number_pad: UIKeyboardTypeNumberPad,
|
85
|
+
phone_pad: UIKeyboardTypePhonePad,
|
86
|
+
name_phone_pad: UIKeyboardTypeNamePhonePad,
|
87
|
+
email: UIKeyboardTypeEmailAddress,
|
88
|
+
decimal_pad: UIKeyboardTypeDecimalPad,
|
89
|
+
twitter: UIKeyboardTypeTwitter,
|
90
|
+
web_search: UIKeyboardTypeWebSearch,
|
91
|
+
alphabet: UIKeyboardTypeASCIICapable
|
92
|
+
}[symbol] || symbol || UIKeyboardTypeDefault
|
93
|
+
end
|
70
94
|
end
|
71
95
|
|
72
96
|
class XLFormSectionDescriptor
|
@@ -100,6 +124,7 @@ class XLFormSectionDescriptor
|
|
100
124
|
def sectionOptions
|
101
125
|
@section_options || originalSectionOptions
|
102
126
|
end
|
127
|
+
|
103
128
|
alias_method :options, :sectionOptions
|
104
129
|
|
105
130
|
def self.parse_section_options(options)
|
@@ -132,3 +157,16 @@ class XLFormSectionDescriptor
|
|
132
157
|
}[symbol] || symbol || XLFormSectionOptionNone
|
133
158
|
end
|
134
159
|
end
|
160
|
+
|
161
|
+
class XLFormTextFieldCell
|
162
|
+
|
163
|
+
attr_accessor :keyboard_type
|
164
|
+
|
165
|
+
alias :old_update :update
|
166
|
+
|
167
|
+
def update
|
168
|
+
old_update
|
169
|
+
|
170
|
+
self.textField.keyboardType = self.keyboard_type if self.keyboard_type
|
171
|
+
end
|
172
|
+
end
|
@@ -21,10 +21,10 @@ module ProMotion
|
|
21
21
|
end
|
22
22
|
|
23
23
|
set_nav_bar_button :left, {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
system_item: item,
|
25
|
+
title: title,
|
26
|
+
action: 'on_cancel:'
|
27
|
+
}
|
28
28
|
end
|
29
29
|
|
30
30
|
if form_options[:on_save]
|
@@ -37,10 +37,10 @@ module ProMotion
|
|
37
37
|
end
|
38
38
|
|
39
39
|
set_nav_bar_button :right, {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
system_item: item,
|
41
|
+
title: title,
|
42
|
+
action: 'on_save:'
|
43
|
+
}
|
44
44
|
end
|
45
45
|
|
46
46
|
self.form_added if self.respond_to?(:form_added)
|
@@ -55,12 +55,13 @@ module ProMotion
|
|
55
55
|
form_options = self.class.get_form_options
|
56
56
|
title = self.class.title
|
57
57
|
required = form_options[:required]
|
58
|
+
auto_focus = form_options[:auto_focus]
|
58
59
|
|
59
60
|
@form_builder = PM::XLForm.new(self.form_data,
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
title: title,
|
62
|
+
required: required,
|
63
|
+
auto_focus: auto_focus
|
64
|
+
)
|
64
65
|
@form_object = @form_builder.build
|
65
66
|
self.form = @form_object
|
66
67
|
end
|
@@ -262,7 +263,17 @@ module ProMotion
|
|
262
263
|
if new_value.is_a? XLFormOptionsObject
|
263
264
|
new_value = new_value.formValue
|
264
265
|
end
|
265
|
-
|
266
|
+
|
267
|
+
case arity = callback.arity
|
268
|
+
when 0 then
|
269
|
+
callback.call
|
270
|
+
when 2 then
|
271
|
+
callback.call(old_value, new_value)
|
272
|
+
when 3 then
|
273
|
+
callback.call(old_value, new_value, row)
|
274
|
+
else
|
275
|
+
mp("Callback requires 0, 2, or 3 paramters", force_color: :red)
|
276
|
+
end
|
266
277
|
end
|
267
278
|
end
|
268
279
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion-XLForm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Michotte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ProMotion
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- lib/ProMotion-XLForm.rb
|
92
92
|
- lib/ProMotion/XLForm/cells/xl_form_cell.rb
|
93
93
|
- lib/ProMotion/XLForm/cells/xl_form_color_selector_cell.rb
|
94
|
-
- lib/ProMotion/XLForm/cells/xl_form_image_selector_cell.rb
|
95
94
|
- lib/ProMotion/XLForm/ui_alert_controller.rb
|
96
95
|
- lib/ProMotion/XLForm/validators/regex_validator.rb
|
97
96
|
- lib/ProMotion/XLForm/validators/url_validator.rb
|
@@ -127,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
126
|
version: '0'
|
128
127
|
requirements: []
|
129
128
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.4.5.1
|
131
130
|
signing_key:
|
132
131
|
specification_version: 4
|
133
132
|
summary: Adds PM::XLFormScreen support to ProMotion, similar to ProMotion-form.
|
@@ -1,162 +0,0 @@
|
|
1
|
-
module ProMotion
|
2
|
-
class XLFormImageSelectorCell < XLFormCell
|
3
|
-
|
4
|
-
def self.formDescriptorCellHeightForRowDescriptor(_)
|
5
|
-
100
|
6
|
-
end
|
7
|
-
|
8
|
-
def setup(data_cell, screen)
|
9
|
-
super
|
10
|
-
|
11
|
-
size = (data_cell[:height] || 100) - 20
|
12
|
-
|
13
|
-
@imageview = UIImageView.alloc.initWithFrame([[0, 0], [size, size]])
|
14
|
-
self.accessoryView = @imageview
|
15
|
-
|
16
|
-
self.selectionStyle = UITableViewCellSelectionStyleNone
|
17
|
-
self.backgroundColor = UIColor.whiteColor
|
18
|
-
self.separatorInset = UIEdgeInsetsZero
|
19
|
-
self.editingAccessoryView = self.accessoryView
|
20
|
-
end
|
21
|
-
|
22
|
-
def update
|
23
|
-
@imageview.image = value
|
24
|
-
end
|
25
|
-
|
26
|
-
def formDescriptorCellDidSelectedWithFormController(controller)
|
27
|
-
if Kernel.const_defined?("UIAlertController") && UIAlertController.respond_to?(:'alertControllerWithTitle:message:preferredStyle:')
|
28
|
-
alert = UIAlertController.alertControllerWithTitle(self.rowDescriptor.selectorTitle,
|
29
|
-
message: nil,
|
30
|
-
preferredStyle: UIAlertControllerStyleActionSheet)
|
31
|
-
|
32
|
-
alert.addAction(UIAlertAction.actionWithTitle(NSLocalizedString("Choose From Library", nil),
|
33
|
-
style: UIAlertActionStyleDefault,
|
34
|
-
handler: lambda { |_|
|
35
|
-
open_from_alert(UIImagePickerControllerSourceTypePhotoLibrary)
|
36
|
-
}))
|
37
|
-
|
38
|
-
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceTypeCamera)
|
39
|
-
alert.addAction(UIAlertAction.actionWithTitle(NSLocalizedString("Take Photo", nil),
|
40
|
-
style: UIAlertActionStyleDefault,
|
41
|
-
handler: lambda { |_|
|
42
|
-
open_from_alert(UIImagePickerControllerSourceTypeCamera)
|
43
|
-
}))
|
44
|
-
end
|
45
|
-
|
46
|
-
if UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad
|
47
|
-
alert.modalPresentationStyle = UIModalPresentationPopover
|
48
|
-
alert.popoverPresentationController.sourceView = self.contentView
|
49
|
-
alert.popoverPresentationController.sourceRect = self.contentView.bounds
|
50
|
-
end
|
51
|
-
|
52
|
-
present = -> {
|
53
|
-
Dispatch::Queue.main.async do
|
54
|
-
self.formViewController.presentViewController(alert, animated: true, completion: nil)
|
55
|
-
end
|
56
|
-
}
|
57
|
-
if self.formViewController.presentedViewController
|
58
|
-
self.formViewController.dismissViewControllerAnimated(true, completion: present)
|
59
|
-
else
|
60
|
-
present.call
|
61
|
-
end
|
62
|
-
|
63
|
-
else
|
64
|
-
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceTypeCamera)
|
65
|
-
action_sheet = UIActionSheet.alloc.initWithTitle(self.rowDescriptor.selectorTitle,
|
66
|
-
delegate: self,
|
67
|
-
cancelButtonTitle: NSLocalizedString("Cancel", nil),
|
68
|
-
destructiveButtonTitle: nil,
|
69
|
-
otherButtonTitles: NSLocalizedString("Choose From Library", nil), NSLocalizedString("Take Photo", nil), nil)
|
70
|
-
else
|
71
|
-
action_sheet = UIActionSheet.alloc.initWithTitle(self.rowDescriptor.selectorTitle,
|
72
|
-
delegate: self,
|
73
|
-
cancelButtonTitle: NSLocalizedString("Cancel", nil),
|
74
|
-
destructiveButtonTitle: nil,
|
75
|
-
otherButtonTitles: NSLocalizedString("Choose From Library", nil), nil)
|
76
|
-
end
|
77
|
-
action_sheet.tag = self.tag
|
78
|
-
action_sheet.showInView(self.formViewController.view)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# trick to force the status bar to be hidden when presenting the UIImagePickerViewController
|
83
|
-
def navigationController(_, willShowViewController: _, animated: _)
|
84
|
-
UIApplication.sharedApplication.setStatusBarHidden true
|
85
|
-
end
|
86
|
-
|
87
|
-
# UIActionSheetDelegate
|
88
|
-
def actionSheet(action_sheet, clickedButtonAtIndex: button_index)
|
89
|
-
return if button_index == action_sheet.cancelButtonIndex
|
90
|
-
|
91
|
-
title = action_sheet.buttonTitleAtIndex(button_index)
|
92
|
-
|
93
|
-
case title
|
94
|
-
when NSLocalizedString("Choose From Library", nil)
|
95
|
-
open_from_alert(UIImagePickerControllerSourceTypePhotoLibrary)
|
96
|
-
when NSLocalizedString("Take Photo", nil)
|
97
|
-
open_from_alert(UIImagePickerControllerSourceTypeCamera)
|
98
|
-
else
|
99
|
-
return
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def open_from_alert(source)
|
104
|
-
open = -> {
|
105
|
-
open_picker(source)
|
106
|
-
}
|
107
|
-
|
108
|
-
if @popover_controller && @popover_controller.isPopoverVisible
|
109
|
-
@popover_controller.dismissPopoverAnimated(true)
|
110
|
-
open.call
|
111
|
-
elsif self.formViewController.presentedViewController
|
112
|
-
self.formViewController.dismissViewControllerAnimated(true, completion: open)
|
113
|
-
else
|
114
|
-
open.call
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def open_picker(source)
|
119
|
-
@image_picker = UIImagePickerController.alloc.init
|
120
|
-
@image_picker.delegate = self
|
121
|
-
@image_picker.allowsEditing = true
|
122
|
-
@image_picker.sourceType = source
|
123
|
-
|
124
|
-
if UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad
|
125
|
-
@popover_controller = UIPopoverController.alloc.initWithContentViewController(@image_picker)
|
126
|
-
Dispatch::Queue.main.async do
|
127
|
-
@popover_controller.presentPopoverFromRect(self.contentView.frame,
|
128
|
-
inView: self.formViewController.view,
|
129
|
-
permittedArrowDirections: UIPopoverArrowDirectionAny,
|
130
|
-
animated: true)
|
131
|
-
end
|
132
|
-
else
|
133
|
-
self.formViewController.presentViewController(@image_picker,
|
134
|
-
animated: true,
|
135
|
-
completion: nil)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
# UIImagePickerControllerDelegate
|
140
|
-
def imagePickerController(_, didFinishPickingMediaWithInfo: info)
|
141
|
-
editedImage = info[UIImagePickerControllerEditedImage]
|
142
|
-
originalImage = info[UIImagePickerControllerOriginalImage]
|
143
|
-
if editedImage
|
144
|
-
imageToUse = editedImage
|
145
|
-
else
|
146
|
-
imageToUse = originalImage
|
147
|
-
end
|
148
|
-
|
149
|
-
self.value = imageToUse
|
150
|
-
@imageview.image = imageToUse
|
151
|
-
|
152
|
-
if UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad
|
153
|
-
if @popover_controller && @popover_controller.isPopoverVisible
|
154
|
-
@popover_controller.dismissPopoverAnimated(true)
|
155
|
-
end
|
156
|
-
else
|
157
|
-
self.formViewController.dismissViewControllerAnimated(true, completion: nil)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
end
|
162
|
-
end
|