motion-prime/elements/base_element.rb in motion-prime-1.0.6 vs motion-prime/elements/base_element.rb in motion-prime-1.0.7
- old
+ new
@@ -22,10 +22,11 @@
def initialize(options = {})
options[:screen] = options[:screen].try(:weak_ref)
@options = options
@screen = options[:screen]
@section = options[:section]
+ @_has_section = @section.present?
@view_class = options[:view_class] || 'UIView'
@name = options[:name]
@block = options[:block]
@view_name = underscore_factory(self.class_name_without_kvo.demodulize).gsub(/(_draw)?_element/, '')
@@ -47,10 +48,12 @@
index = @@_allocated_elements.index(@_element_info)
@@_allocated_elements.delete_at(index) if index
end
Prime.logger.dealloc_message :element, self, self.name
super
+ rescue # "undefined `super` method" bug fix
+ Prime.logger.debug "Undefined `super` in `base_element`"
end
def add_target(target = nil, action = 'on_click:', event = :touch)
return false unless self.view
self.view.addTarget(target || section, action: action, forControlEvents: event.uicontrolevent)
@@ -92,10 +95,12 @@
block_options = compute_block_options || {}
raw_options = self.options.except(:screen, :name, :block, :view_class).merge(block_options)
compute_style_options(raw_options)
raw_options = Styles.for(styles).deep_merge(raw_options)
@computed_options = raw_options
- normalize_options(@computed_options, section.try(:elements_eval_object), %w[
+ return unless @_has_section
+ NSLog('ERRROR') unless section
+ normalize_options(@computed_options, section.send(:elements_eval_object), %w[
font font_name font_size text placeholder title_label
padding padding_left padding_right padding_top padding_bottom
left right min_width min_outer_width max_width max_outer_width width
top bottom min_height min_outer_height max_height max_outer_height height])
end
\ No newline at end of file