class Elevate::HTTP::ActivityIndicator
Public Class Methods
instance()
click to toggle source
# File lib/elevate/http/activity_indicator.rb, line 4 def self.instance Dispatch.once { @instance = new } @instance end
new()
click to toggle source
# File lib/elevate/http/activity_indicator.rb, line 10 def initialize @lock = NSLock.alloc.init @count = 0 end
Public Instance Methods
hide()
click to toggle source
# File lib/elevate/http/activity_indicator.rb, line 15 def hide toggled = false @lock.lock @count -= 1 if @count > 0 toggled = @count == 0 @lock.unlock update_indicator(false) if toggled end
show()
click to toggle source
# File lib/elevate/http/activity_indicator.rb, line 26 def show toggled = false @lock.lock toggled = @count == 0 @count += 1 @lock.unlock update_indicator(true) if toggled end
Private Instance Methods
update_indicator(visible)
click to toggle source
# File lib/elevate/http/activity_indicator.rb, line 39 def update_indicator(visible) UIApplication.sharedApplication.networkActivityIndicatorVisible = visible end