Created
December 18, 2014 10:31
-
-
Save jacklynrose/b1671e62e23f8ce1e4bd to your computer and use it in GitHub Desktop.
I do love motion-kit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProfileLayout < MotionKit::Layout | |
def layout | |
add UIImageView, :profile_image | |
add UILabel, :name_label | |
add UILabel, :bio_label | |
background_color UIColor.whiteColor | |
end | |
def profile_image_style | |
image UIImage.imageNamed("profile_photo.jpg") | |
constraints do | |
top_left.equals(:superview).plus([20, 40]) | |
width.equals(100) | |
height.equals(100) | |
end | |
end | |
def name_label_style | |
text "Jack Watson-Hamblin" | |
color UIColor.blackColor | |
font UIFont.boldSystemFontOfSize(24) | |
adjusts_font_size_to_fit_width true | |
minimum_scale_factor 0.8 | |
constraints do | |
top.equals(:superview).plus(40) | |
left.equals(:profile_image, :right).plus(10) | |
right.equals(:superview).minus(20) | |
end | |
end | |
def bio_label_style | |
text "Programmer and Teacher, master of that RubyMotion thing! Blogs at blog.motioninmotion.tv and you can view my screencasts for $9/month at motioninmotion.tv" | |
color UIColor.darkGrayColor | |
number_of_lines 0 | |
constraints do | |
top.equals(:name_label, :bottom).plus(5) | |
height.is <= 61 | |
left.equals(:name_label) | |
right.equals(:name_label) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment