Class: RootViewController

Inherits:
UIViewController
  • Object
show all
Defined in:
app/root_view_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#counterLabelObject

Returns the value of attribute counterLabel.



3
4
5
# File 'app/root_view_controller.rb', line 3

def counterLabel
  @counterLabel
end

Instance Method Details

#loadViewObject



5
6
7
8
9
10
11
12
13
14
# File 'app/root_view_controller.rb', line 5

def loadView
  super
  self.counterLabel = UILabel.alloc.initWithFrame([[60,80],[200,40]])
  self.counterLabel.textAlignment = UITextAlignmentCenter
  self.counterLabel.backgroundColor = UIColor.darkGrayColor
  self.counterLabel.font = UIFont.boldSystemFontOfSize(20)
  self.counterLabel.layer.cornerRadius = 5.0
  self.counterLabel.text = "Sync will start"
  self.view.addSubview(self.counterLabel)
end

#viewDidLoadObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/root_view_controller.rb', line 16

def viewDidLoad
  super
  self.title = "Root"
  self.view.backgroundColor = UIColor.whiteColor

  @sync = Motionscan::Sync.init
  @sync.startWithStatus(
    lambda {
      NSLog("sync started")
    },
    success:lambda {|result|
      self.counterLabel.removeFromSuperview
      addScannerViewControllerButton
    },
    error:lambda {|error|
      p error
    },
    progress:lambda {|progress, total|
      self.counterLabel.text = "#{progress} / #{total}"
    }
  )
end