Skip to content

Commit

Permalink
Merge pull request clayallsopp#160 from quatro/master
Browse files Browse the repository at this point in the history
Added "on_end" callback for the string_row, fixed most likely what is a ...
  • Loading branch information
clayallsopp committed Oct 12, 2013
2 parents 2c79bd6 + 0d0c590 commit 73d8567
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/formotion/patch/ui_text_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def should_end?(&block)
# block takes argument textField
def on_end(&block)
add_delegate_method do
@delegate.textFieldDidBeginEditing_callback = block
@delegate.textFieldDidEndEditing_callback = block
end
end

Expand Down
6 changes: 6 additions & 0 deletions lib/formotion/row/row.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class Row < Formotion::Base
attr_accessor :on_tap_callback
# callback for when a row is tapped
attr_accessor :on_delete_callback
# callback for when a row is exited
attr_accessor :on_end_callback

# RowType object
attr_accessor :object
Expand Down Expand Up @@ -304,6 +306,10 @@ def on_enter(&block)
def on_begin(&block)
self.on_begin_callback = block
end

def on_end(&block)
self.on_end_callback = block
end

# Used in :button type rows
def on_tap(&block)
Expand Down
6 changes: 5 additions & 1 deletion lib/formotion/row_type/string_row.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ def add_callbacks(field)
true
end
end


field.on_end do |text_field|
row.on_end_callback && row.on_end_callback.call
end

field.on_begin do |text_field|
row.on_begin_callback && row.on_begin_callback.call
end
Expand Down

0 comments on commit 73d8567

Please sign in to comment.