Method: ProMotion::Styling#set_easy_attributes

Defined in:
lib/ProMotion/view/styling.rb

#set_easy_attributes(parent, element, args = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ProMotion/view/styling.rb', line 29

def set_easy_attributes(parent, element, args={})
  attributes = {}

  if args[:resize]
    attributes[:autoresizingMask]  = UIViewAutoresizingNone
    args[:resize].each { |r| attributes[:autoresizingMask] |= map_resize_symbol(r) }
  end

  if [:left, :top, :width, :height].select{ |a| args[a] && args[a] != :auto }.length == 4
    attributes[:frame] = CGRectMake(args[:left], args[:top], args[:width], args[:height])
  end

  set_attributes element, attributes
  element
end