Class: Tgios::PhotoController

Inherits:
ExtendedUIViewController show all
Defined in:
lib/tgios/photo_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ExtendedUIViewController

#dealloc, #dismissViewControllerAnimated, #hook, #prepareForRelease, #unhook, #viewDidDisappear

Instance Attribute Details

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/tgios/photo_controller.rb', line 3

def url
  @url
end

Instance Method Details

#onPrepareForReleaseObject



27
28
# File 'lib/tgios/photo_controller.rb', line 27

def onPrepareForRelease
end

#viewDidLoadObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/tgios/photo_controller.rb', line 5

def viewDidLoad
  super
  self.view.backgroundColor = :black.uicolor

  @load_view = LoadingView.add_loading_view_to(self.view)
  unless @url.nil?
    @load_view.start_loading
    ImageLoader.load_url(@url) do |image, success|
      @load_view.stop_loading
      if success && self.view
        # TODO: use motion layout or other way to handle frame size (or allow full screen)
        small_frame = self.view.bounds
        small_frame.size.height -= 20 + 44 if small_frame == UIScreen.mainScreen.bounds

        scroll_view = PhotoScrollView.alloc.initWithFrame(small_frame, image: image)
        self.view.addSubview(scroll_view)
      end
    end

  end
end