Skip to content

Instantly share code, notes, and snippets.

@ewilliam
Created July 20, 2016 06:55
Show Gist options
  • Save ewilliam/94b266c29455ed7997b428c1a42d9c19 to your computer and use it in GitHub Desktop.
Save ewilliam/94b266c29455ed7997b428c1a42d9c19 to your computer and use it in GitHub Desktop.
def assignments=(assignments)
assignments.each_with_index do |a, i|
instance_name = "@assignment_#{i}_view"
# set @assignment_view here if instance_variable_get returns nil
unless instance_variable_get(instance_name)
view = build_assignment_label([[50, 0], [325, 50]], 16, UIFontWeightThin, i)
instance_variable_set(instance_name, view)
end
@assignment_view = instance_variable_get(instance_name)
@assignment_view.text = a.summary
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment