ProMotion-XLForm 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 923b8c482cdd6c8250ad1d93674e85882d9b4b60
4
- data.tar.gz: 2b0b483c71ab93876609e8cf21ceaa6841232520
3
+ metadata.gz: 97b4f80e4bb25b2941de7eb3166ba566a8f1c0cc
4
+ data.tar.gz: d69b0217a03e59a2a06ccd8726be9a4472e13f4f
5
5
  SHA512:
6
- metadata.gz: 49b4311b2154e4cecb32d31df7410c864f07fc06a8957ff55fdfa894506bd82519f989d9b3e8d5ea1c53097d79da7e33c833799edb1f88e32f8f171a6bc93439
7
- data.tar.gz: 68a272448f22f972bd4c4a56082d27317747052c2b75417b9d81bc779d831bff914149893754b8195d4fb7a4c9506055f5ee6d6850568125463c9e4c68948683
6
+ metadata.gz: b950d047e9e13ea131797523c9aa4016531d88167df18315ed0fe0e9af9ce8263e648a057e80b0e3f3b59786cf9e95f1b5043937a3fa431a2af0624bb707a6a0
7
+ data.tar.gz: f34aa52c706ecc217b24eb0bab024c7bd58f1e93e4838e330c70d71297dca4d91ec4469119ad6bb1a00112021be8196fb1a47b8e9babc4d73a91c22f9ca57d1a
data/README.md CHANGED
@@ -290,10 +290,39 @@ Finally, you can provide a PM::Validator with a `valid?(cell)` method.
290
290
  }
291
291
  ```
292
292
 
293
+ ### Appearance
294
+ You can change the appearance of the cell using the `appearance` hash
293
295
 
294
- ## Todo
295
- - Tests
296
- - A lot of other things :)
296
+ ```ruby
297
+ {
298
+ title: 'Options',
299
+ name: 'options',
300
+ type: :selector_push,
301
+ appearance: {
302
+ font: UIFont.fontWithName('Helvetica Neue', size: 15.0),
303
+ detail_font: UIFont.fontWithName('Helvetica Neue', size: 12.0),
304
+ color: UIColor.greenColor,
305
+ detail_color: UIColor.blueColor,
306
+ background_color: UIColor.grayColor
307
+ },
308
+ options: {
309
+ "value_1" => "Value 1",
310
+ "value_2" => "Value 2",
311
+ "value_3" => "Value 3",
312
+ "value_4" => "Value 4",
313
+ }
314
+ }
315
+ ```
316
+
317
+ You can also pass any key-value to configure your cell. Take a look at [this](https://github.com/xmartlabs/XLForm#additional-configuration-of-rows) for more information
318
+
319
+ ```ruby
320
+ {
321
+ appearance: {
322
+ "slider.tintColor" => UIColor.grayColor
323
+ }
324
+ }
325
+ ```
297
326
 
298
327
  ## Contributing
299
328
 
@@ -116,7 +116,7 @@ module ProMotion
116
116
  cell.selectorTitle = cell_data[:selector_title] if cell_data[:selector_title]
117
117
  cell.options = cell_data[:options]
118
118
 
119
- cell.disabled = !cell_data[:enabled] if cell_data[:enabled]
119
+ cell.disabled = !cell_data.fetch(:enabled, true)
120
120
 
121
121
  # row visible
122
122
  if cell_data[:hidden]
@@ -212,6 +212,20 @@ module ProMotion
212
212
  end
213
213
  end
214
214
 
215
+ # customization
216
+ appearance = cell_data[:appearance]
217
+ if appearance
218
+ cell.cellConfig["textLabel.font"] = appearance[:font] if appearance[:font]
219
+ cell.cellConfig["textLabel.textColor"] = appearance[:color] if appearance[:color]
220
+ cell.cellConfig["detailTextLabel.font"] = appearance[:detail_font] if appearance[:detail_font]
221
+ cell.cellConfig["detailTextLabel.textColor"] = appearance[:detail_color] if appearance[:detail_color]
222
+ cell.cellConfig["backgroundColor"] = appearance[:background_color] if appearance[:background_color]
223
+
224
+ appearance.delete_if {|k,v| k.is_a?(Symbol)}.each do |k,v|
225
+ cell.cellConfig[k] = v
226
+ end
227
+ end
228
+
215
229
  value = cell_data[:value]
216
230
  if value and cell.selectorOptions
217
231
  cell.selectorOptions.each do |opt|
@@ -103,6 +103,7 @@ module ProMotion
103
103
  alert = UIAlertView.new
104
104
  alert.title = NSLocalizedString('Error', nil)
105
105
  alert.message = errors.join(', ')
106
+ alert.addButtonWithTitle(NSLocalizedString('OK', nil))
106
107
  alert.show
107
108
  end
108
109
  end
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Michotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2015-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ProMotion