Sha256: 07692d71ac65d285e90a7b0633459fd6f42562a5d2fcaa8a6e82623d3a32a897
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module ProMotion module ViewHelper def set_attributes(element, args = {}) args.each do |k, v| if v.is_a? Hash # TODO: Do this recursively v.each do |k2, v2| sub_element = element.send("#{k}") sub_element.send("#{k2}=", v2) if sub_element.respond_to?("#{k2}=") end elsif v.is_a? Array element.send("#{k}", *v) if element.respond_to?("#{k}") else element.send("#{k}=", v) if element.respond_to?("#{k}=") end end element end def frame_from_array(array) return CGRectMake(array[0], array[1], array[2], array[3]) if array.length == 4 Console.log(" - frame_from_array expects an array with four elements: [x, y, width, height]", withColor: Console::RED_COLOR) CGRectZero end def content_height(view) height = 0 view.subviews.each do |sub_view| next if sub_view.isHidden y = sub_view.frame.origin.y h = sub_view.frame.size.height if (y + h) > height height = y + h end end height end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ProMotion-0.5.0 | lib/ProMotion/helpers/view_helper.rb |
ProMotion-0.4.1 | lib/ProMotion/_helpers/view_helper.rb |
ProMotion-0.4.0 | lib/ProMotion/_helpers/view_helper.rb |