Skip to content

Commit

Permalink
Merge pull request #241 from morsedigital/master
Browse files Browse the repository at this point in the history
Added check for existence of old and new values in image_row
  • Loading branch information
clayallsopp committed Mar 18, 2015
2 parents 63d71d6 + 3baba8e commit 9172381
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/formotion/row_type/image_row.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ def build_cell(cell)
add_plus_accessory(cell) if row.editable? && (row.value == nil)

observe(self.row, "value") do |old_value, new_value|
@image_view.image = new_value
if new_value
self.row.row_height = 200
cell.accessoryView = cell.editingAccessoryView = nil
else
self.row.row_height = 44
# only show the "plus" when editable
add_plus_accessory(cell) if row.editable? && (row.value == nil)
if old_value and new_value
@image_view.image = new_value
if new_value
self.row.row_height = 200
cell.accessoryView = cell.editingAccessoryView = nil
else
self.row.row_height = 44
# only show the "plus" when editable
add_plus_accessory(cell) if row.editable? && (row.value == nil)
end
row.form.reload_data
end
row.form.reload_data
end

@image_view = UIImageView.alloc.init
Expand Down

0 comments on commit 9172381

Please sign in to comment.