Method: MotionPrime::ScreenIndicatorsMixin#show_activity_indicator

Defined in:
motion-prime/screens/extensions/_indicators_mixin.rb

#show_activity_indicator(render_target = nil, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'motion-prime/screens/extensions/_indicators_mixin.rb', line 3

def show_activity_indicator(render_target = nil, options = {})
  render_target ||= view
  @activity_indicator_view ||= {}
  indicator = @activity_indicator_view[render_target.object_id] ||= begin
    indicator = UIActivityIndicatorView.gray
    render_target.addSubview(indicator)
    indicator
  end

  center = options[:center] || {}
  indicator.center = CGPointMake(center.fetch(:x, render_target.center.x), center.fetch(:y, render_target.center.y))
  indicator.startAnimating
end