Skip to content

Instantly share code, notes, and snippets.

@jacklynrose
Created December 18, 2014 10:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacklynrose/b1671e62e23f8ce1e4bd to your computer and use it in GitHub Desktop.
Save jacklynrose/b1671e62e23f8ce1e4bd to your computer and use it in GitHub Desktop.
I do love motion-kit
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