Skip to content

lightningminers/Mockingbird

Repository files navigation

Mockingbird

Tag v0.0.1

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实现扫描条码

OC

create bridging header file and set module Yes,then you import product name -Swift.h file

UIStoryboard *stor = [UIStoryboard storyboardWithName:@"Mockingbird" bundle:[NSBundle mainBundle]];
UINavigationController *navc =  [stor instantiateViewControllerWithIdentifier:@"MockingbirdNavigationID"];
MockingbirdScanCodeManager *mocking = (MockingbirdScanCodeManager *)navc.topViewController;
mocking.mockingbirdResult = ^(NSString * __nonnull value){
    self.showScanCodeInfo.text = value;
};
[self presentViewController:navc animated:YES completion:nil];

License

This code is distributed under the terms and conditions of the MIT license.