Class: Tgios::LoadingView
- Inherits:
-
UIView
- Object
- UIView
- Tgios::LoadingView
- Defined in:
- lib/tgios/loading_indicator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.add_loading_view_to(view) ⇒ Object
30 31 32 33 34 |
# File 'lib/tgios/loading_indicator.rb', line 30 def self.add_loading_view_to(view) loading_view = LoadingView.alloc.initWithFrame(view.bounds) CommonUIUtility.add_full_subview(view, loading_view) loading_view end |
Instance Method Details
#initWithFrame(frame) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tgios/loading_indicator.rb', line 4 def initWithFrame(frame) if super self.hidden = true base_view = Base.style(UIView.new, backgroundColor: :black.uicolor, alpha: 0.5) @indicator = UIActivityIndicatorView.large [{super_view: self, subview: base_view}, {super_view: self, subview: @indicator}].each do |hash| CommonUIUtility.add_full_subview(hash[:super_view], hash[:subview]) end @label = Base.style(UILabel.new, frame: self.bounds, font: lambda {UIFont.systemFontOfSize(22)}, textAlignment: :center.uialignment, backgroundColor: :clear.uicolor, textColor: :white.uicolor) @label.sizeToFit Motion::Layout.new do |l| l.view self l.subviews 'label' => @label l.vertical '[label]-290-|' l.horizontal '|-20-[label]-20-|' end end self end |
#start_loading(text = '') ⇒ Object
36 37 38 39 40 |
# File 'lib/tgios/loading_indicator.rb', line 36 def start_loading(text='') @label.text = text self.hidden = false @indicator.startAnimating end |
#stop_loading ⇒ Object
42 43 44 45 |
# File 'lib/tgios/loading_indicator.rb', line 42 def stop_loading self.hidden = true @indicator.stopAnimating end |