Swift开发条码扫描器:Mockingbird

jopen 9年前

 Swift开发条码扫描器:Mockingbird

Requirements

  • iOS 7.0+
  • Xcode 6.3

Use

let storyboard:UIStoryboard = UIStoryboard(name: "Mockingbird", bundle: NSBundle.mainBundle())  let navC:UINavigationController = storyboard.instantiateViewControllerWithIdentifier("MockingbirdNavigationID") as! UINavigationController  let mockingbird:MockingbirdScanCodeManager = navC.topViewController as! MockingbirdScanCodeManager  mockingbird.globalTitle = "扫描条码"  mockingbird.globalColor = MOKTeal  self.presentViewController(navC, animated: true, completion: nil)

property

  • globalColor:UIColor? 设置全局的颜色
  • globalTitle:String? 设置导航标题
  • previewLineColor:UIColor? 设置线动画的颜色

Notification

NSNotificationCenter.defaultCenter().addObserver(self, selector: "mockingbird:", name:MOKNotifiScanResult, object: nil)

scan code result | 通过通知来获取扫描的结果

OR Callback Func

scan code result | 或者通过回调函数

mockingbird.mockingbirdResult = {(value:String?)->Void in     println(value)     println("回调函数")     if let _value = value{         self.scancode.text = _value     }  }

how learning used AVFoundation to create scan code

how learning used AVFoundation to create scan code | 利用AVFoundation实现扫描条码


项目主页:
http://www.open-open.com/lib/view/home/1434464821895