iOS开发中的多媒体与界面构建
1. 条形码扫描与生成
在iOS 7中,苹果将条形码扫描功能集成到了AVFoundation框架中。AVFoundation支持多种条形码格式,包括QR Code、Code 128、UPC、EAN、Interleaved等,甚至还支持Aztec和DataMatrix等较新的格式。
1.1 条形码扫描步骤
- 创建项目 :创建一个名为Camera_2的单视图项目。
- 添加头文件和属性 :在ViewController.h中添加以下代码:
#import <UIKit/UIKit.h>
@import AVFoundation;
@interface ViewController : UIViewController
@end
AVCaptureSession *session;
AVCaptureDevice *theCamera;
AVCaptureDeviceInput *theInputSource;
AVCaptureMetadataOutput *theOutputSource;
AVCaptureVideoPreviewLayer *thePreview;
- 初始化属性 :在ViewController.m的viewDidLoad方法中添加以下代码:
iOS多媒体与界面开发指南
超级会员免费看
订阅专栏 解锁全文
727

被折叠的 条评论
为什么被折叠?



