tgios 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/lib/tgios/ui_table_view_list_binding.rb +1 -1
- data/lib/tgios/ui_table_view_model_binding.rb +19 -4
- data/lib/tgios/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTE5MWFhYjg4NzVjY2ExZjk0YmNiMWQ3ZDcwNjg4ODUzODJkN2U5Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTU3MGM3MTY3MzY4MDI2MzFkMDFkZTYxZWUwMzI1MGU2ZjMzZmY2ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzYzNGE4NDExMGU5ZmZkNWE2ZDRhYWI0ZjE4Y2QxODIwMzM3MDc2NWEzMDJh
|
10
|
+
ZjIyOTFhYjJjNWI2MGRkNDE0Y2JiMmZhZDU5NDA1OTY4YTVjNmJhN2RjOTUy
|
11
|
+
OTJmOWRlOTE3ZmE3ZjJlNTI0ZTI2OTQ5Y2ZmN2U1NmJlMGZiOWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWQ1NjI1ZWY4OWY1MmE5MGEwZGFjNDdlMjRhNjllZWVkMjY3MzQwNTJkMGRh
|
14
|
+
MzhjNjk1NzY5MzExZjlhYWE5M2FlNmExMjhiZDIzMTNjYTI2YzAwNjE3ZmQy
|
15
|
+
YTdkOTY0YTY3NWM2MzQwOTY4MDI4MWUxMmRjZjRhMWQ0MTY2NjU=
|
data/Gemfile.lock
CHANGED
@@ -33,6 +33,7 @@ module Tgios
|
|
33
33
|
@events[:build_cell]=->(cell_identifier, type) { build_cell(cell_identifier, type) }
|
34
34
|
@events[:update_cell]=->(field_set, cell, index_path) { create_or_update_field(field_set, cell, index_path)}
|
35
35
|
@events[:update_accessory]=->(field_set, cell, index_path, ui_field) { update_accessory_type_or_view(field_set, cell, index_path, ui_field)}
|
36
|
+
@events[:update_cell_height]=->(field_set, index_path) { update_cell_height(field_set, index_path) }
|
36
37
|
end
|
37
38
|
|
38
39
|
|
@@ -83,6 +84,10 @@ module Tgios
|
|
83
84
|
if type == :checkbox
|
84
85
|
cell = UITableViewCell.default(cell_identifier)
|
85
86
|
cell.textLabel.numberOfLines = 0
|
87
|
+
elsif type == :dynamic_label || type == :big_label
|
88
|
+
cell = UITableViewCell.value2(cell_identifier)
|
89
|
+
cell.detailTextLabel.numberOfLines = 0
|
90
|
+
cell.detailTextLabel.backgroundColor = :clear.uicolor
|
86
91
|
else
|
87
92
|
cell = UITableViewCell.value2(cell_identifier)
|
88
93
|
cell.textLabel.numberOfLines = 2
|
@@ -126,9 +131,7 @@ module Tgios
|
|
126
131
|
end
|
127
132
|
text_field_binding.update(ui_field, @model)
|
128
133
|
ui_field.becomeFirstResponder if field_set[:first_responder] # TODO: not work when cell is not visible, buggy
|
129
|
-
when :big_label
|
130
|
-
cell.detailTextLabel.numberOfLines = 0
|
131
|
-
cell.detailTextLabel.backgroundColor = :clear.uicolor
|
134
|
+
when :big_label, :dynamic_label
|
132
135
|
cell.detailTextLabel.text = @model.send(field_set[:name])
|
133
136
|
|
134
137
|
when :array
|
@@ -222,10 +225,22 @@ module Tgios
|
|
222
225
|
def tableView(tableView, heightForRowAtIndexPath: index_path)
|
223
226
|
field_set = field_set_at_index_path(index_path)
|
224
227
|
field_set = field_set[:child_field] unless field_set[:child_index].nil?
|
228
|
+
@events[:update_cell_height].call(field_set, index_path)
|
229
|
+
end
|
230
|
+
|
231
|
+
def update_cell_height(field_set, index_path)
|
225
232
|
if field_set[:type] == :big_label || field_set[:type] == :checkbox
|
226
|
-
|
233
|
+
26 + 19 * (field_set[:lines] || 2)
|
227
234
|
elsif field_set[:type] == :text_view
|
228
235
|
110
|
236
|
+
elsif field_set[:type] == :dynamic_label
|
237
|
+
width = 284
|
238
|
+
width -= 20 unless field_set[:accessory].nil? || field_set[:accessory] == :none
|
239
|
+
width -= 94 if field_set[:show_label]
|
240
|
+
height = @model.send(field_set[:name]).sizeWithFont(UIFont.systemFontOfSize(14),
|
241
|
+
constrainedToSize: [width, 9999],
|
242
|
+
lineBreakMode: UILineBreakModeCharacterWrap).height + 20
|
243
|
+
[height, 45].max
|
229
244
|
else
|
230
245
|
45
|
231
246
|
end
|
data/lib/tgios/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tgios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- April Tsang
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sugarcube
|