Created
September 19, 2013 09:08
-
-
Save Flink/6620948 to your computer and use it in GitHub Desktop.
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 MovieScreen < PM::Screen | |
title 'Movie details' | |
stylesheet :movie_details | |
attr_accessor :movie | |
def on_load | |
self.title = movie.full_title | |
end | |
def will_present | |
layout(view, :main_view) do | |
subview(scroll, :scroll) do | |
subview(image_container, :poster) | |
subview(overview_label, :overview) | |
subview(movie_staff.view, :staff_list) | |
end | |
end | |
overview_label.sizeToFit | |
image_container.setImageWithURL(poster_url) | |
movie_staff.view.frame = [[0, 10 + overview_label.size.height], [view.frame.size.width, view.frame.size.height]] | |
end | |
def on_appear | |
movie_staff.view.frame = [[0, 10 + overview_label.size.height], [view.frame.size.width, movie_staff.view.contentSize.height]] | |
scroll.contentSize = [scroll.frame.size.width, content_height(scroll)] | |
end | |
private | |
def scroll | |
@scroll ||= UIScrollView.alloc.initWithFrame(view.bounds) | |
end | |
def image_container | |
@image_container ||= UIImageView.new | |
end | |
def overview_label | |
@overview_label ||= movie.overview.uilabel | |
end | |
def movie_staff | |
@movie_staff ||= MovieStaffScreen.new(movie: movie) | |
end | |
def poster_url | |
"#{ Settings.hostname }#{ movie.poster[:suggested] }".nsurl | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment