Class: ScannerViewController
- Inherits:
-
UIViewController
- Object
- UIViewController
- ScannerViewController
- Defined in:
- app/scanner_view_controller.rb
Instance Method Summary collapse
Instance Method Details
#init ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/scanner_view_controller.rb', line 3 def init super @overlay = UILabel.alloc.initWithFrame([[10,10],[300,40]]) @overlay.textAlignment = UITextAlignmentCenter @overlay.alpha = 0.8 @overlay.backgroundColor = UIColor.darkGrayColor @overlay.layer.zPosition = 2 self.view.addSubview(@overlay) self end |
#viewDidAppear(animated) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/scanner_view_controller.rb', line 14 def viewDidAppear(animated) @scanner = Motionscan::Scanner.initWithFrame(self.view.bounds) @scanner.displayScannerInView(self.view) @scanner.startWithStatus( lambda { @overlay.text = "Will start scanning" }, success:lambda {|result| @overlay.text = "#{result.data[:type]}" }, error:lambda {|error|}, notFound:lambda {} ) end |
#viewWillDisappear(animated) ⇒ Object
29 30 31 |
# File 'app/scanner_view_controller.rb', line 29 def viewWillDisappear(animated) @scanner.stop end |