In Android, I used zxing for bar code scanning. Now I found a free and open-source bar code scanning SDK for iPhone. The following describes how to use this SDK.
The free bar code is zbar and its address is: http://zbar.sourceforge.net/iphone/sdkdoc/install.html
The following figure shows the implementation result:
The QR code can be used to obtain the value of the QR code.
The specific implementation process is as follows:
First download the zbr SDK.
Then, create the project, iPhone. scanbar.
Third, add the downloaded zbarsdk to the project.
Fourth, Add. Framework to the project.
Fifth, add a button to process the effect.
# Pragma mark-
# Pragma mark onclickbutton
-(Ibaction) onbutton :( ID) sender
{
Zbarreaderviewcontroller * reader = [zbarreaderviewcontroller new];
Reader. readerdelegate = self;
Zbarimageworkflow * reader. Category = reader. category;
[Export setsymbology: zbar_i25
Config: zbar_assist_enable
To: 0];
[Self presentmodalviewcontroller: Reader
Animated: Yes];
[READER release];
}
-(Void) imagepickercontroller: (uiimagepickercontroller *) Reader
Didfinishpickingmediawithinfo: (nsdictionary *) info
{
ID <nsfastenumeration> Results =
[Info objectforkey: zbarreadercontrollerresults];
Zbarsymbol * symbol = nil;
For (symbol in results)
Break;
Nslog (@ "==%@", symbol. data );
Resulttext. Text = symbol. Data;
Resultimage. Image =
[Info objectforkey: uiimagepickercontrolleroriginalimage];
[READER dismissmodalviewcontrolleranimated: Yes];
}
Source code: http://easymorse-iphone.googlecode.com/svn/trunk/iphone.scanbar/
Share:
In Android, I used zxing for bar code scanning. Now I found a free and open-source bar code scanning SDK for iPhone. The following describes how to use this SDK.
The free bar code is zbar and its address is: http://zbar.sourceforge.net/iphone/sdkdoc/install.html
The following figure shows the implementation result:
The QR code can be used to obtain the value of the QR code.
The specific implementation process is as follows:
First download the zbr SDK.
Then, create the project, iPhone. scanbar.
Third, add the downloaded zbarsdk to the project.
Fourth, Add. Framework to the project.
Fifth, add a button to process the effect.
# Pragma mark-
# Pragma mark onclickbutton
-(Ibaction) onbutton :( ID) sender
{
Zbarreaderviewcontroller * reader = [zbarreaderviewcontroller new];
Reader. readerdelegate = self;
Zbarimageworkflow * reader. Category = reader. category;
[Export setsymbology: zbar_i25
Config: zbar_assist_enable
To: 0];
[Self presentmodalviewcontroller: Reader
Animated: Yes];
[READER release];
}
-(Void) imagepickercontroller: (uiimagepickercontroller *) Reader
Didfinishpickingmediawithinfo: (nsdictionary *) info
{
ID <nsfastenumeration> Results =
[Info objectforkey: zbarreadercontrollerresults];
Zbarsymbol * symbol = nil;
For (symbol in results)
Break;
Nslog (@ "==%@", symbol. data );
Resulttext. Text = symbol. Data;
Resultimage. Image =
[Info objectforkey: uiimagepickercontrolleroriginalimage];
[READER dismissmodalviewcontrolleranimated: Yes];
}
Source code: http://easymorse-iphone.googlecode.com/svn/trunk/iphone.scanbar/