Barcode128View 0.3.2

Barcode128View 0.3.2

Maintained by Moi.



  • By
  • zimmer

Barcode128View

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Barcode128View is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Barcode128View"

Usage

Storyboard setup

First add an UIView to your UIViewController and set its class as Barcode128View as it shown in the picture below.
![alt tag](https://cloud.githubusercontent.com/assets/12252587/16590622/9d7a3212-42d8-11e6-9bec-ec847fb40abf.png)

Then, you just have to set all the properties in the attributs inspector and the View will update its content automatically
alt tag

Code setup

If you want to set your Barcode128View properties manually, you can link the view in your code
@IBOutlet weak var codeView: Barcode128View!

then, set the properties

codeView.code128String = "0123456789"
/* optionnal */
codeView.font = UIFont.systemFont(ofSize: 20)
codeView.barColor = UIColor.black
codeView.textColor = UIColor.darkGray
codeView.showCode = true
codeView.padding = 0

Manual setup

You can create a Barcode128View manually with the init(frame:) method and set all the properties
let codeView = Barcode128View(frame: frame)

or with the custom init method bay adding the wanted properties in the init(frame:) method parameters

let secondCodeView = Barcode128View(frame: CGRect(x: 0, y: 0, width: 250, height: 150),
                        code128String: "012345678999",
                        /* optionnal */
                        barColor: .black,
                        textColor: .darkGray,
                        padding: 0,
                        showCode: true,
                        fontName: "Helvetica",
                        fontSize: 30
                        //or font: UIFont.systemFontOfSize(30)
)
view.addSubview(secondCodeView)

Attributes

open var code128String: String! // default ""
open var barColor: UIColor! // default .black
open var textColor: UIColor! // default .black
open var padding: CGFloat! // default 0
open var showCode: Bool! // default false
open var fontName: String! // default "System"
open var fontSize: CGFloat! // default 16
open var font: UIFont! // default UIFont.systemFont(ofSize: 16)

Author

Zimmer

License

Barcode128View is available under the MIT license. See the LICENSE file for more info.