Skip to content

Instantly share code, notes, and snippets.

@forrestgrant
Created January 16, 2014 19:28
Show Gist options
  • Save forrestgrant/8461684 to your computer and use it in GitHub Desktop.
Save forrestgrant/8461684 to your computer and use it in GitHub Desktop.
Extending UIView
class DetailScreen < PM::Screen
def will_appear
view << UILabel.build(
frame: [[10, 10], [100, 20]],
text: "Foo Bar",
font: UIFont.systemFontOfSize(18),
textColor: UIColor.redColor
)
end
end
class UIView
def self.build(args = {})
element = self.alloc.init
args.each do |a, i|
element.send("#{a}=".to_sym, i)
end
element
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment