Commit 3682188e authored by 勾芒's avatar 勾芒

debug

parent 58637248
......@@ -411,6 +411,7 @@
[Customermanager manager].customerPhoneNumber = nil;
[Customermanager manager].companyName = nil;
[Customermanager manager].cutomerAddress = nil;
self.customerHeader.image = nil;
[self.changePersonInformationButton setTitle:@"更改客户信息" forState:UIControlStateNormal];
[self ChangeCustomerName];
[self QueryShoppingCarNumber];
......
......@@ -87,8 +87,6 @@
[self uiConfigAction];
[self GetdatasAciton];
// [self getShoppingCardata];
// [self getGuideAllcustomerOrder];
}
......@@ -154,12 +152,9 @@
//订单
TOOrderEntity *Neworder = [[TOOrderEntity alloc]init];
Neworder.guideId = [Shoppersmanager manager].Shoppers.employee.fid;
Neworder.consumerId = _model.fid;
allOrder.datapage = page;
allOrder.order = Neworder;
//客户
TOConsumerEntity *customer = [[TOConsumerEntity alloc]init];
customer.fid = _model.fid;
allOrder.consumer = customer;
[self getGuideAllcustomerOrder:allOrder isRemove:YES];
}
}];
......@@ -203,12 +198,10 @@
//订单
TOOrderEntity *Neworder = [[TOOrderEntity alloc]init];
Neworder.guideId = [Shoppersmanager manager].Shoppers.employee.fid;
Neworder.consumerId = _model.fid;
allOrder.datapage = page;
allOrder.order = Neworder;
//客户
TOConsumerEntity *customer = [[TOConsumerEntity alloc]init];
customer.fid = _model.fid;
allOrder.consumer = customer;
[self getGuideAllcustomerOrder:allOrder isRemove:NO];
}
}
......@@ -278,7 +271,7 @@
orderdetails.orderCode = model.orderNumber;
orderdetails.sectionTitle = @[@"订单信息",@"客户信息",@"收货信息",@"商品信息",@"附件信息"];
orderdetails.isShowattachment = YES;
if ([model.orderState isEqualToString:@"006"]) {
if ([model.orderState isEqualToString:@"006"] || [model.orderState isEqualToString:@"002"]) {
orderdetails.isShowPrintButton = YES;
orderdetails.isDelectedButton = NO;
}
......@@ -309,7 +302,6 @@
self.shoppingBagTotalPage = (int)returnValue[@"data"][@"totalPages"];
if (shopcar.shopcart.count == 0) {
[self PromptinformationViewWithimage:TCImage(@"ablum-副本") withTitle:@"暂无购物袋信息~" withpoint:CGPointMake(ScreenHeight/2, ScreenWidth/2)];
[self RemoveMBProgressHUDLoding];
[self endRefreshingForTableView:self.ClientdetailsTableview];
}
//自定义属性
......@@ -361,6 +353,11 @@
}
OrderResponse *Allorder = [[OrderResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
self.orderRecordTotalPage = (int)returnValue[@"data"][@"totalPages"];
if (Allorder.orderBillList.count == 0) {
[self PromptinformationViewWithimage:TCImage(@"changjingtubiao") withTitle:@"暂无订单信息~" withpoint:CGPointMake(ScreenHeight/2, ScreenWidth/2)];
[self RemoveMBProgressHUDLoding];
[self endRefreshingForTableView:self.ClientdetailsTableview];
}
for (OrderBill *model in Allorder.orderBillList) {
[self.orderRecordArray addObject:model];
}
......
......@@ -214,6 +214,7 @@
{
selectedIndex = 4;
ProductLibraryViewController *productVC = [SHARED_APPDELEGATE.allControllerArray objectAtIndex_opple:4];
productVC.barcode = nil;
[productVC.productCollectionView.mj_header beginRefreshing];
}else if ([Name isEqualToString:@"客户管理"])
{
......@@ -233,7 +234,6 @@
{
selectedIndex = 0;
}
self.customtabbar.selectedIndex = selectedIndex;
}
......
......@@ -66,6 +66,10 @@
*/
@property (nonatomic,assign) NSInteger cellindex;
/**
* 是否支持滑动返回
*/
@property (nonatomic,assign) BOOL isSliding;
......
......@@ -42,9 +42,12 @@
{
[super viewDidAppear:animated];
// 禁用 iOS7 返回手势
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
if (self.isSliding) {
// 禁用 iOS7 返回手势
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}
}
......@@ -89,7 +92,7 @@
- (void)getOrderDetailsData
{
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/order/findOrder/",_orderCode] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/order/findOrder/",self.orderCode] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
......@@ -478,15 +481,18 @@
}];
}]];
[self presentViewController:alertVC animated:YES completion:nil];
}
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
......
......@@ -110,15 +110,7 @@
self.view.backgroundColor = [UIColor blueColor];
[self uiConfigAction];
//扫描二维码结果
if (self.barcode) {
[self barCodeSearchRequest];
}else
{
[self GetdatasAction];
}
[self GetdatasAction];
}
......@@ -204,6 +196,8 @@
} WithErrorCodeBlock:^(id errorCodeValue) {
[self ErrorMBProgressView:@"网络连接中断"];
[self RemoveMBProgressHUDLoding];
} WithFailureBlock:^(id error) {
[self endRefreshingForTableView:self.productCollectionView];
......@@ -232,22 +226,31 @@
//下拉刷新
MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
//默认数据
GoodsCondition *conditon = [[GoodsCondition alloc]init];
//分页数据
DataPage *Newpage = [[DataPage alloc]init];
Newpage.page = 1;
Newpage.rows = KROWS;
conditon.page = Newpage;
self.indexPage = 1;
//搜索
if (_selectedCode) {
conditon.categoryEquals = _selectedCode;
conditon.nameLike = _selectedCode;
//扫描二维码结果
if (self.barcode) {
[self barCodeSearchRequest];
}else
{
//默认数据
GoodsCondition *conditon = [[GoodsCondition alloc]init];
//分页数据
DataPage *Newpage = [[DataPage alloc]init];
Newpage.page = 1;
Newpage.rows = KROWS;
conditon.page = Newpage;
self.indexPage = 1;
//搜索
if (_selectedCode) {
conditon.categoryEquals = _selectedCode;
conditon.nameLike = _selectedCode;
}
[self.productCollectionView.mj_footer resetNoMoreData];
[self getScreeningdatasisRemoveArray:YES];
[self getGoodsListDatasisRemove:YES Withobject:conditon];
}
[self.productCollectionView.mj_footer resetNoMoreData];
[self getScreeningdatasisRemoveArray:YES];
[self getGoodsListDatasisRemove:YES Withobject:conditon];
}];
headerRefresh.stateLabel.hidden = YES;
headerRefresh.lastUpdatedTimeLabel.hidden = YES;
......@@ -257,23 +260,31 @@
//上拉加载
self.productCollectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
//默认数据
GoodsCondition *conditon = [[GoodsCondition alloc]init];
//分页数据
DataPage *Newpage = [[DataPage alloc]init];
if (self.indexPage ++ > self.totalPages) {
[self.productCollectionView.mj_footer endRefreshingWithNoMoreData];
//扫描二维码结果
if (self.barcode) {
[self barCodeSearchRequest];
}else
{
Newpage.page = self.indexPage ++;
Newpage.rows = KROWS;
conditon.page = Newpage;
//搜索
if (_selectedCode) {
conditon.categoryEquals = _selectedCode;
conditon.nameLike = _selectedCode;
//默认数据
GoodsCondition *conditon = [[GoodsCondition alloc]init];
//分页数据
DataPage *Newpage = [[DataPage alloc]init];
if (self.indexPage ++ > self.totalPages) {
[self.productCollectionView.mj_footer endRefreshingWithNoMoreData];
}else
{
Newpage.page = self.indexPage ++;
Newpage.rows = KROWS;
conditon.page = Newpage;
//搜索
if (_selectedCode) {
conditon.categoryEquals = _selectedCode;
conditon.nameLike = _selectedCode;
}
[self getGoodsListDatasisRemove:NO Withobject:conditon];
}
[self getGoodsListDatasisRemove:NO Withobject:conditon];
}
}];
}
......@@ -282,25 +293,31 @@
#pragma mark 填条形码搜索
- (void)barCodeSearchRequest
{
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@%@",ServerAddress,@"/goods/getGoodsByCode/",_barcode] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
TOGoodsEntity *goods = [[TOGoodsEntity alloc]initWithDictionary:returnValue[@"data"] error:nil];
NSLog(@"%@",goods);
[self.datasArray removeAllObjects];
[self.datasArray addObject:goods];
[self.productCollectionView reloadData];
}else
{
[self promptCustomerWithString:@"查询失败"];
[self ErrorMBProgressView:@"查询失败"];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[self ErrorMBProgressView:@"网络连接中断"];
[self RemoveMBProgressHUDLoding];
} WithFailureBlock:^(id error) {
[self promptCustomerWithString:@"查询失败"];
[self ErrorMBProgressView:@"查询失败"];
[self RemoveMBProgressHUDLoding];
}];
}
......
......@@ -113,7 +113,7 @@
// CGRect cropRect = self.scanRectView.frame;
// CGFloat p1 = size.height/size.width;
// CGFloat p2 = 1920./1080.; //使用1080p的图像输出
output.rectOfInterest = CGRectMake(self.scanRectView.frame.origin.y/ScreenHeight,((ScreenWidth-self.scanRectView.frame.size.width)/2)/ScreenWidth+0.1, self.scanRectView.frame.size.height/ScreenHeight, self.scanRectView.frame.size.width/ScreenWidth);
output.rectOfInterest = CGRectMake(self.scanRectView.frame.origin.y/ScreenHeight,((ScreenWidth-self.scanRectView.frame.size.width)/2)/ScreenWidth, self.scanRectView.frame.size.height/ScreenHeight, self.scanRectView.frame.size.width/ScreenWidth);
//
// CGFloat fixHeight = [UIScreen mainScreen].bounds.size.width * 1920. / 1080.;
......
......@@ -109,6 +109,7 @@
self.SpaceButton.layer.cornerRadius = 10;
[self.backView addSubview:self.StyleButton];
[self.backView addSubview:self.SpaceButton];
self.indexPage = 1;
//下拉刷新
......@@ -138,10 +139,10 @@
{
//默认数据
SceneCondition *condition = [[SceneCondition alloc]init];
DataPage *page = [[DataPage alloc]init];
page.page = self.indexPage ++;
page.rows = KROWS;
condition.page = page;
DataPage *Newpage = [[DataPage alloc]init];
Newpage.page = self.indexPage ++;
Newpage.rows = KROWS;
condition.page = Newpage;
[self getSceneLibrarydatas:condition isRemove:NO];
}
}];
......@@ -183,7 +184,7 @@
[self.responseArray removeAllObjects];
}
SceneResponse *response = [[SceneResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
self.indexPage = (int)returnValue[@"data"][@"totalPages"];
self.totalPages = (int)returnValue[@"data"][@"totalPages"];
for (TOSceneEntity *model in response.list) {
[self.responseArray addObject:model];
}
......@@ -235,7 +236,8 @@
#pragma mark -筛选风格
- (void)screeningStyleButtonClick:(UIButton *)sender {
[self ShowPopoverViewController:CGSizeMake(200, 300) Withdatas:self.filter.styles ShowButton:sender SelectedIndex:0];
[self dismissViewControllerAnimated:NO completion:nil];
[self ShowPopoverViewController:CGSizeMake(150, 200) Withdatas:self.filter.styles ShowButton:sender SelectedIndex:0];
}
......@@ -243,7 +245,8 @@
#pragma mark -空间风格
- (void)HouseStyleButtonClick:(UIButton *)sender {
[self ShowPopoverViewController:CGSizeMake(200, 300) Withdatas:self.filter.space ShowButton:sender SelectedIndex:1];
[self dismissViewControllerAnimated:NO completion:nil];
[self ShowPopoverViewController:CGSizeMake(150, 200) Withdatas:self.filter.space ShowButton:sender SelectedIndex:1];
}
......
......@@ -291,6 +291,7 @@
[self CreateMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSLog(@"支付成功");
[self ErrorMBProgressView:@"支付成功"];
if (self.PaySuccessReturnBlock) {
self.PaySuccessReturnBlock();
}
......
......@@ -386,7 +386,7 @@
for (int i=0; i<goodArray.count-1; i++) {
ShopcarModel *model = [goodArray objectAtIndex_opple:i];
TOOrderdetailEntity *orderGoods = [[TOOrderdetailEntity alloc]init];
orderGoods.goodsId = model.fid;
orderGoods.goodsId = model.goodsId;
orderGoods.goodsCover = model.goods.pictures;
orderGoods.goodsCode = model.goods.code;
orderGoods.goodsSpec = model.goods.spec;
......@@ -427,6 +427,7 @@
orderDetails.sectionTitle = @[@"订单信息",@"客户信息",@"收货信息",@"商品清单"];
orderDetails.isShowattachment = NO;
orderDetails.isShowPayButton = YES;
orderDetails.isSliding = YES;//取消滑动返回
[self.navigationController pushViewController:orderDetails animated:YES];
}else
......
......@@ -414,6 +414,7 @@
if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSLog(@"写入服务器成功");
[self QueryShoppingCarNumber];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
......@@ -424,7 +425,7 @@
NSLog(@"%@",error);
NSLog(@"写入服务器失败");
}];
[self QueryShoppingCarNumber];
}
......
......@@ -22,7 +22,7 @@
#import "SearchViewController.h"
#import "ScannerViewController.h"
#import "BaseViewController.h"
#import "QRViewController.h"
@interface CustomTabbarController ()<TabbarButtonClickdelegate,ChangpasswordDelegate,CancelButtondelegate,UITextFieldDelegate>
......@@ -197,18 +197,14 @@
if (![Shoppersmanager manager].currentCustomer) {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
// Set the custom view mode to show any view.
hud.mode = MBProgressHUDModeCustomView;
// Set an image view with a checkmark.
UIImage *image = [[UIImage imageNamed:@"Error"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
hud.customView = [[UIImageView alloc] initWithImage:image];
// Looks a bit nicer if we make it square.
hud.square = YES;
// Optional label text.
hud.activityIndicatorColor = kMainBlueColor;
hud.labelFont = [UIFont systemFontOfSize:12];
hud.labelText = @"必须设置当前客户";
[hud hide:YES afterDelay:1];
hud.labelText = @"必须设置当前客户才能访问购物车";
hud.margin = 10.f;
hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
hud.minSize = CGSizeMake(200, 50);
hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES;
[hud hide:YES afterDelay:1.0f];
}else
{
......@@ -265,20 +261,12 @@
- (void)QrcodeButtonClick
{
ScannerViewController *scannerVC = [[ScannerViewController alloc]init];
[scannerVC setReturnScannerResponse:^(id value) {
[self dismissViewControllerAnimated:YES completion:^{
//调用商品控制器
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
ProductLibraryViewController *productVC = [storyboard instantiateViewControllerWithIdentifier:@"productlibrary"];
productVC.barcode = value;
BaseViewController *baseVC = [self.vcArray objectAtIndex_opple:self.selectedIndex];
[baseVC.navigationController pushViewController:productVC animated:YES];
}];
QRViewController *qrVC = [[QRViewController alloc] initWithScanCompleteHandler:^(NSString *url) {
[self dismissViewControllerAnimated:YES completion:nil];
NSLog(@"%@",url);
}];
[self presentViewController:scannerVC animated:YES completion:nil];
[self presentViewController:qrVC animated:YES completion:nil];
}
......
......@@ -45,6 +45,7 @@
self.userName.text = [Shoppersmanager manager].userNameString;
self.passWord.text = [Shoppersmanager manager].passWordString;
// self.userHeader sd_setImageWithURL:[NSURL URLWithString:[Shoppersmanager manager].Shoppers.employee] placeholderImage:<#(UIImage *)#>
}
......@@ -152,6 +153,11 @@
[Shoppersmanager manager].passWordString = self.passWord.text;
[Shoppersmanager manager].Shoppers = result;
//保存用户名密码
[[NSUserDefaults standardUserDefaults] setObject:self.userName.text forKey:USERNAME];
[[NSUserDefaults standardUserDefaults] setObject:self.passWord.text forKey:PASSWORD];
[[NSUserDefaults standardUserDefaults] synchronize];
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
......
......@@ -22,7 +22,7 @@
<rect key="frame" x="0.0" y="0.0" width="260" height="170"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="05产品库-详情_03" id="tuQ-DW-D80">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="矢量智能对象" id="tuQ-DW-D80">
<rect key="frame" x="174" y="18" width="80" height="80"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
......@@ -105,8 +105,8 @@
</view>
</objects>
<resources>
<image name="05产品库-详情_03" width="500" height="375"/>
<image name="Lock-0" width="17" height="21"/>
<image name="User-Profile" width="17" height="17"/>
<image name="矢量智能对象" width="110" height="110"/>
</resources>
</document>
......@@ -127,6 +127,9 @@
29EC331A1CE023D5005F0C13 /* ChangePasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29EC33181CE023D5005F0C13 /* ChangePasswordViewController.m */; };
29EC331B1CE023D5005F0C13 /* ChangePasswordViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 29EC33191CE023D5005F0C13 /* ChangePasswordViewController.xib */; };
29EC331F1CE02AFA005F0C13 /* PopoverViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29EC331E1CE02AFA005F0C13 /* PopoverViewController.m */; };
29F14BA91CF6B60D0005D3E5 /* QRUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F14BA31CF6B60D0005D3E5 /* QRUtil.m */; };
29F14BAA1CF6B60D0005D3E5 /* QRView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F14BA51CF6B60D0005D3E5 /* QRView.m */; };
29F14BAB1CF6B60D0005D3E5 /* QRViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F14BA71CF6B60D0005D3E5 /* QRViewController.m */; };
29F725FB1CE17B0D0072FE0E /* Shoppersmanager.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F725FA1CE17B0D0072FE0E /* Shoppersmanager.m */; };
29F725FE1CE1928F0072FE0E /* opple_objc_json_client.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F725FD1CE1928F0072FE0E /* opple_objc_json_client.m */; };
29F726011CE1D05D0072FE0E /* ScreeningCollectionReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F726001CE1D05D0072FE0E /* ScreeningCollectionReusableView.m */; };
......@@ -352,6 +355,12 @@
29EC33191CE023D5005F0C13 /* ChangePasswordViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ChangePasswordViewController.xib; sourceTree = "<group>"; };
29EC331D1CE02AFA005F0C13 /* PopoverViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopoverViewController.h; sourceTree = "<group>"; };
29EC331E1CE02AFA005F0C13 /* PopoverViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopoverViewController.m; sourceTree = "<group>"; };
29F14BA21CF6B60D0005D3E5 /* QRUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QRUtil.h; sourceTree = "<group>"; };
29F14BA31CF6B60D0005D3E5 /* QRUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QRUtil.m; sourceTree = "<group>"; };
29F14BA41CF6B60D0005D3E5 /* QRView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QRView.h; sourceTree = "<group>"; };
29F14BA51CF6B60D0005D3E5 /* QRView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QRView.m; sourceTree = "<group>"; };
29F14BA61CF6B60D0005D3E5 /* QRViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QRViewController.h; sourceTree = "<group>"; };
29F14BA71CF6B60D0005D3E5 /* QRViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QRViewController.m; sourceTree = "<group>"; };
29F725F91CE17B0D0072FE0E /* Shoppersmanager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shoppersmanager.h; sourceTree = "<group>"; };
29F725FA1CE17B0D0072FE0E /* Shoppersmanager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Shoppersmanager.m; sourceTree = "<group>"; };
29F725FC1CE1928F0072FE0E /* opple_objc_json_client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = opple_objc_json_client.h; sourceTree = "<group>"; };
......@@ -563,6 +572,7 @@
2928F7DE1CD085430036D761 /* Tools */ = {
isa = PBXGroup;
children = (
29F14B931CF6A4B50005D3E5 /* Scanner */,
2902E1301CF2907200268161 /* RefreshHeader */,
294CF0E91CEDCF250055F1D8 /* PromptinformationView */,
29A9DCAA1CEB63BD00A7567A /* PreviewPDF */,
......@@ -1232,6 +1242,19 @@
name = Jastor;
sourceTree = "<group>";
};
29F14B931CF6A4B50005D3E5 /* Scanner */ = {
isa = PBXGroup;
children = (
29F14BA21CF6B60D0005D3E5 /* QRUtil.h */,
29F14BA31CF6B60D0005D3E5 /* QRUtil.m */,
29F14BA41CF6B60D0005D3E5 /* QRView.h */,
29F14BA51CF6B60D0005D3E5 /* QRView.m */,
29F14BA61CF6B60D0005D3E5 /* QRViewController.h */,
29F14BA71CF6B60D0005D3E5 /* QRViewController.m */,
);
name = Scanner;
sourceTree = "<group>";
};
29F725F81CE17AE40072FE0E /* Shopperscenter */ = {
isa = PBXGroup;
children = (
......@@ -1438,6 +1461,7 @@
2998763C1CD9983A00C90D0A /* CommodityListTableViewCell.m in Sources */,
2962D0791CD1CBC60058829D /* NetworkRequestClassManager.m in Sources */,
29F725FB1CE17B0D0072FE0E /* Shoppersmanager.m in Sources */,
29F14BA91CF6B60D0005D3E5 /* QRUtil.m in Sources */,
29EAAEA01CDC79DC00C4DBA2 /* CustomerOrderViewController.m in Sources */,
04F9EE1E1CF25F7300BD729F /* ShareViewController.m in Sources */,
2928F8321CD09E320036D761 /* Toolview.m in Sources */,
......@@ -1489,6 +1513,7 @@
29A9DCAE1CEB643C00A7567A /* PDFViewController.m in Sources */,
29EAAE8E1CDC3E8E00C4DBA2 /* BillingInfoView.m in Sources */,
0470D6141CE2938000647F0F /* ProductLibraryView.m in Sources */,
29F14BAB1CF6B60D0005D3E5 /* QRViewController.m in Sources */,
29D260F81CEEAF2D00A9787D /* FullScreenViewCell.m in Sources */,
29CB70F11CEC4607003508BF /* ScannerViewController.m in Sources */,
290887061CE58BC2000B7097 /* screeningButton.m in Sources */,
......@@ -1497,6 +1522,7 @@
299249441CDB51B100786B1E /* ModifyShippingAddressView.m in Sources */,
2906B5D71CD89246000849B4 /* ClientDetailsTableViewCell.m in Sources */,
29BB27801CD9DFD7009A0813 /* AboutViewController.m in Sources */,
29F14BAA1CF6B60D0005D3E5 /* QRView.m in Sources */,
29F725FE1CE1928F0072FE0E /* opple_objc_json_client.m in Sources */,
29834EC01CDF5E4E001A484F /* ScreeningFirstCollectionViewCell.m in Sources */,
29834EC51CDF76C1001A484F /* UserViewController.m in Sources */,
......
......@@ -107,8 +107,8 @@
- (void)RemoveMBProgressHUDLoding;
{
// [self.TCHud hide:YES afterDelay:1];
[self.TCHud hide:YES];
self.TCHud = nil;
[_TCHud hide:YES];
_TCHud = nil;
}
......@@ -119,12 +119,12 @@
// Set the custom view mode to show any view.
hud.mode = MBProgressHUDModeCustomView;
// Set an image view with a checkmark.
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
hud.customView = [[UIImageView alloc] initWithImage:image];
// Looks a bit nicer if we make it square.
hud.square = YES;
// hud.square = YES;
// Optional label text.
hud.activityIndicatorColor = kMainBlueColor;
hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.6];
hud.labelFont = [UIFont systemFontOfSize:12];
hud.labelText = successString;
[hud hide:YES afterDelay:1];
......
......@@ -32,6 +32,19 @@
[self.view addSubview:self.webView];
self.webView.delegate = self;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:_pdfURLString]];
NSURL *url = [NSURL URLWithString:_pdfURLString];
if ([url pathExtension] && ([[[url pathExtension] lowercaseString] isEqualToString:@"txt"] || [[[url pathExtension] lowercaseString] isEqualToString:@"text"]))
{
// return [self convertTxtEncoding:url];
NSURLRequest *request = [NSURLRequest requestWithURL:[self convertTxtEncoding:url]];
[self.webView loadRequest:request];
}
else
{
// return url;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:_pdfURLString]];
[self.webView loadRequest:request];
}
[self.webView loadRequest:request];
[self.webView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(PDFClickAction)]];
}
......@@ -52,6 +65,76 @@
- (NSURL *)convertTxtEncoding:(NSURL *)fileUrl
{
//
// if ([FileManagementAPI getFileSize:[fileUrl path]] > 1024*1024.0f)
//
// {
//
// return fileUrl;
//
// }
NSString *tmpFilePath = [NSString stringWithFormat:@"%@/tmp/%@", NSHomeDirectory(), [fileUrl lastPathComponent]];
NSLog(@"tmpFilePath=%@", tmpFilePath);
NSURL *tmpFileUrl = [NSURL fileURLWithPath:tmpFilePath];
NSStringEncoding encode;
NSString *contentStr = [NSString stringWithContentsOfURL:fileUrl usedEncoding:&encode error:NULL];
if (contentStr)
{
[contentStr writeToURL:tmpFileUrl atomically:YES encoding:NSUTF16StringEncoding error:NULL];
return tmpFileUrl;
}
else
{
NSStringEncoding convertEncoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
contentStr = [NSString stringWithContentsOfURL:fileUrl encoding:convertEncoding error:NULL];
if (contentStr)
{
[contentStr writeToURL:tmpFileUrl atomically:YES encoding:NSUTF16StringEncoding error:NULL];
return tmpFileUrl;
}
else
{
return fileUrl;
}
}
}
......
......@@ -32,7 +32,7 @@
self.popoverTableView.showsVerticalScrollIndicator = NO;
self.popoverTableView.tableFooterView = [UIView new];
[self.view addSubview:self.popoverTableView];
self.popoverTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// self.popoverTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.popoverTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"popovercell"];
}
......@@ -62,7 +62,7 @@
cell.textLabel.text = [[self.datasArray objectAtIndex_opple:indexPath.row] typename];
}
cell.textLabel.textAlignment = NSTextAlignmentCenter;
cell.textLabel.font = [UIFont systemFontOfSize:12];
cell.textLabel.font = [UIFont systemFontOfSize:14];
return cell;
}
......@@ -104,7 +104,7 @@
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 60;
return 44;
}
......
//
// QRUtil.h
// QRWeiXinDemo
//
// Created by lovelydd on 15/10/9.
// Copyright (c) 2015年 lovelydd. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
@interface QRUtil : NSObject
+ (CGRect)screenBounds;
+ (AVCaptureVideoOrientation) videoOrientationFromCurrentDeviceOrientation;
@end
//
// QRUtil.m
// QRWeiXinDemo
//
// Created by lovelydd on 15/10/9.
// Copyright (c) 2015年 lovelydd. All rights reserved.
//
#import "QRUtil.h"
@implementation QRUtil
+ (CGRect)screenBounds {
UIScreen *screen = [UIScreen mainScreen];
CGRect screenRect;
if (![screen respondsToSelector:@selector(fixedCoordinateSpace)] && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
// screenRect = CGRectMake(screen.bounds.origin.x, screen.bounds.origin.y, screen.bounds.size.height, screen.bounds.size.width);
screenRect = CGRectMake(0, 0, screen.bounds.size.height, screen.bounds.size.width);
} else {
screenRect = screen.bounds;
}
return screenRect;
}
+ (AVCaptureVideoOrientation) videoOrientationFromCurrentDeviceOrientation {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait) {
NSLog(@"UIInterfaceOrientationPortrait");
return AVCaptureVideoOrientationPortrait;
} else if (orientation == UIInterfaceOrientationLandscapeLeft) {
NSLog(@"AVCaptureVideoOrientationLandscapeLeft");
return AVCaptureVideoOrientationLandscapeLeft;
} else if (orientation == UIInterfaceOrientationLandscapeRight){
NSLog(@"UIInterfaceOrientationLandscapeRight");
return AVCaptureVideoOrientationLandscapeRight;
} else if (orientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"UIInterfaceOrientationPortraitUpsideDown");
return AVCaptureVideoOrientationPortraitUpsideDown;
}
return AVCaptureVideoOrientationPortrait;
}
@end
//
// QRView.h
// QRWeiXinDemo
//
// Created by lovelydd on 15/4/25.
// Copyright (c) 2015年 lovelydd. All rights reserved.
//
#import <UIKit/UIKit.h>
//#import "QRMenu.h"
@protocol QRViewDelegate <NSObject>
//- (void)scanTypeConfig:(QRItem *)item;
@end
@interface QRView : UIView
@property (nonatomic, weak) id<QRViewDelegate> delegate;
/**
* 透明的区域
*/
@property (nonatomic, assign) CGSize transparentArea;
@end
//
// QRView.m
// QRWeiXinDemo
//
// Created by lovelydd on 15/4/25.
// Copyright (c) 2015年 lovelydd. All rights reserved.
//
#import "QRView.h"
#import "QRUtil.h"
static NSTimeInterval kQrLineanimateDuration = 0.02;
@implementation QRView {
UIImageView *qrLine;
CGFloat qrLineY;
// QRMenu *qrMenu;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
if (!qrLine) {
[self initQRLine];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:kQrLineanimateDuration target:self selector:@selector(show) userInfo:nil repeats:YES];
[timer fire];
}
// if (!qrMenu) {
// [self initQrMenu];
// }
}
- (void)initQRLine {
CGRect screenBounds = [QRUtil screenBounds];
qrLine = [[UIImageView alloc] initWithFrame:CGRectMake(screenBounds.size.width / 2 - self.transparentArea.width / 2, screenBounds.size.height / 2 - self.transparentArea.height / 2, self.transparentArea.width, 2)];
qrLine.image = [UIImage imageNamed:@"qr_scan_line"];
qrLine.contentMode = UIViewContentModeScaleAspectFill;
[self addSubview:qrLine];
qrLineY = qrLine.frame.origin.y;
}
//
//- (void)initQrMenu {
//
// CGFloat height = 100;
// CGFloat width = [QRUtil screenBounds].size.width;
// qrMenu = [[QRMenu alloc] initWithFrame:CGRectMake(0, [QRUtil screenBounds].size.height - height, width, height)];
// qrMenu.backgroundColor = [UIColor grayColor];
// [self addSubview:qrMenu];
//
// __weak typeof(self)weakSelf = self;
//
// qrMenu.didSelectedBlock = ^(QRItem *item){
//
// NSLog(@"点击的是%u",item.type);
//
// if ([weakSelf.delegate respondsToSelector:@selector(scanTypeConfig:)] ) {
//
// [weakSelf.delegate scanTypeConfig:item];
// }
// };
//}
- (void)show {
[UIView animateWithDuration:kQrLineanimateDuration animations:^{
CGRect rect = qrLine.frame;
rect.origin.y = qrLineY;
qrLine.frame = rect;
} completion:^(BOOL finished) {
CGFloat maxBorder = self.frame.size.height / 2 + self.transparentArea.height / 2 - 4;
if (qrLineY > maxBorder) {
qrLineY = self.frame.size.height / 2 - self.transparentArea.height /2;
}
qrLineY++;
}];
}
- (void)drawRect:(CGRect)rect {
//整个二维码扫描界面的颜色
CGSize screenSize =[QRUtil screenBounds].size;
CGRect screenDrawRect =CGRectMake(0, 0, screenSize.width,screenSize.height);
//中间清空的矩形框
CGRect clearDrawRect = CGRectMake(screenDrawRect.size.width / 2 - self.transparentArea.width / 2,
screenDrawRect.size.height / 2 - self.transparentArea.height / 2,
self.transparentArea.width,self.transparentArea.height);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[self addScreenFillRect:ctx rect:screenDrawRect];
[self addCenterClearRect:ctx rect:clearDrawRect];
[self addWhiteRect:ctx rect:clearDrawRect];
[self addCornerLineWithContext:ctx rect:clearDrawRect];
}
- (void)addScreenFillRect:(CGContextRef)ctx rect:(CGRect)rect {
CGContextSetRGBFillColor(ctx, 40 / 255.0,40 / 255.0,40 / 255.0,0.5);
CGContextFillRect(ctx, rect); //draw the transparent layer
}
- (void)addCenterClearRect :(CGContextRef)ctx rect:(CGRect)rect {
CGContextClearRect(ctx, rect); //clear the center rect of the layer
}
- (void)addWhiteRect:(CGContextRef)ctx rect:(CGRect)rect {
CGContextStrokeRect(ctx, rect);
CGContextSetRGBStrokeColor(ctx, 1, 1, 1, 1);
CGContextSetLineWidth(ctx, 0.8);
CGContextAddRect(ctx, rect);
CGContextStrokePath(ctx);
}
- (void)addCornerLineWithContext:(CGContextRef)ctx rect:(CGRect)rect{
//画四个边角
CGContextSetLineWidth(ctx, 2);
CGContextSetRGBStrokeColor(ctx, 89 /255.0, 172/255.0, 220/255.0, 1);//绿色
//左上角
CGPoint poinsTopLeftA[] = {
CGPointMake(rect.origin.x+0.7, rect.origin.y),
CGPointMake(rect.origin.x+0.7 , rect.origin.y + 15)
};
CGPoint poinsTopLeftB[] = {CGPointMake(rect.origin.x, rect.origin.y +0.7),CGPointMake(rect.origin.x + 15, rect.origin.y+0.7)};
[self addLine:poinsTopLeftA pointB:poinsTopLeftB ctx:ctx];
//左下角
CGPoint poinsBottomLeftA[] = {CGPointMake(rect.origin.x+ 0.7, rect.origin.y + rect.size.height - 15),CGPointMake(rect.origin.x +0.7,rect.origin.y + rect.size.height)};
CGPoint poinsBottomLeftB[] = {CGPointMake(rect.origin.x , rect.origin.y + rect.size.height - 0.7) ,CGPointMake(rect.origin.x+0.7 +15, rect.origin.y + rect.size.height - 0.7)};
[self addLine:poinsBottomLeftA pointB:poinsBottomLeftB ctx:ctx];
//右上角
CGPoint poinsTopRightA[] = {CGPointMake(rect.origin.x+ rect.size.width - 15, rect.origin.y+0.7),CGPointMake(rect.origin.x + rect.size.width,rect.origin.y +0.7 )};
CGPoint poinsTopRightB[] = {CGPointMake(rect.origin.x+ rect.size.width-0.7, rect.origin.y),CGPointMake(rect.origin.x + rect.size.width-0.7,rect.origin.y + 15 +0.7 )};
[self addLine:poinsTopRightA pointB:poinsTopRightB ctx:ctx];
CGPoint poinsBottomRightA[] = {CGPointMake(rect.origin.x+ rect.size.width -0.7 , rect.origin.y+rect.size.height+ -15),CGPointMake(rect.origin.x-0.7 + rect.size.width,rect.origin.y +rect.size.height )};
CGPoint poinsBottomRightB[] = {CGPointMake(rect.origin.x+ rect.size.width - 15 , rect.origin.y + rect.size.height-0.7),CGPointMake(rect.origin.x + rect.size.width,rect.origin.y + rect.size.height - 0.7 )};
[self addLine:poinsBottomRightA pointB:poinsBottomRightB ctx:ctx];
CGContextStrokePath(ctx);
}
- (void)addLine:(CGPoint[])pointA pointB:(CGPoint[])pointB ctx:(CGContextRef)ctx {
CGContextAddLines(ctx, pointA, 2);
CGContextAddLines(ctx, pointB, 2);
}
@end
//
// QRViewController.h
// QRWeiXinDemo
//
// Created by lovelydd on 15/4/25.
// Copyright (c) 2015年 lovelydd. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void(^ScanCompleteBlock)(NSString *url);
@interface QRViewController : UIViewController
@property (nonatomic, copy, readonly) NSString *urlString;
- (instancetype)initWithScanCompleteHandler:(ScanCompleteBlock)scanCompleteBlock;
- (void)stopRunning;
@end
//
// QRViewController.m
// QRWeiXinDemo
//
// Created by lovelydd on 15/4/25.
// Copyright (c) 2015年 lovelydd. All rights reserved.
//
#import "QRViewController.h"
#import <AVFoundation/AVFoundation.h>
#import "QRView.h"
#import "QRUtil.h"
@interface QRViewController ()<AVCaptureMetadataOutputObjectsDelegate,QRViewDelegate>
@property (strong, nonatomic) AVCaptureDevice * device;
@property (strong, nonatomic) AVCaptureDeviceInput * input;
@property (strong, nonatomic) AVCaptureMetadataOutput * output;
@property (strong, nonatomic) AVCaptureSession * session;
@property (strong, nonatomic) AVCaptureVideoPreviewLayer * preview;
@property (nonatomic, strong) UIButton *backBtn;
@property (nonatomic, strong) QRView *qrView;
@property (nonatomic, copy) ScanCompleteBlock scanCompleteBlock;
@property (nonatomic, copy, readwrite) NSString *urlString;
/**
* 提示lebe
*/
@property (nonatomic,strong) UILabel *Titlelabe;
/**
*计时器
*/
@property (strong, nonatomic) CADisplayLink *link;
/**
* 指示线
*/
@property (strong, nonatomic) UIImageView *instructionsLine;
/**
*用于记录scrollLine的上下循环状态
*/
@property (assign, nonatomic) BOOL up;
@end
@implementation QRViewController
#pragma mark - Life Cycle
- (void)viewDidLoad {
[super viewDidLoad];
//计时器添加到循环中去
_up = YES;
[self.link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
[self defaultConfig]; //初始化配置,主要是二维码的配置
[self configUI];
[self updateLayout];
}
- (void)defaultConfig {
[self startRunning];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (![_session isRunning]) {
[self startRunning];
}
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self stopRunning];
}
- (void)configUI {
[self.view addSubview:self.qrView];
[self.view addSubview:self.backBtn];
[self.view addSubview:self.Titlelabe];
[self.view addSubview:self.instructionsLine];
}
- (void)updateLayout {
_qrView.center = CGPointMake([QRUtil screenBounds].size.width / 2, [QRUtil screenBounds].size.height / 2);
//修正扫描区域
CGFloat screenHeight = self.view.frame.size.height;
CGFloat screenWidth = self.view.frame.size.width;
CGRect cropRect = CGRectMake((screenWidth - self.qrView.transparentArea.width) / 2,
(screenHeight - self.qrView.transparentArea.height) / 2,
self.qrView.transparentArea.width,
self.qrView.transparentArea.height);
[_output setRectOfInterest:CGRectMake(cropRect.origin.y / screenHeight,
cropRect.origin.x / screenWidth,
cropRect.size.height / screenHeight,
cropRect.size.width / screenWidth)];
}
- (void)pop:(UIButton *)button {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - Public Method
-(instancetype)initWithScanCompleteHandler:(ScanCompleteBlock)scanCompleteBlock {
self = [super init];
if (self) {
_scanCompleteBlock = scanCompleteBlock;
}
return self;
}
- (void)startRunning {
_device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
// Input
_input = [AVCaptureDeviceInput deviceInputWithDevice:self.device error:nil];
// Output
_output = [[AVCaptureMetadataOutput alloc]init];
[_output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
// Session
_session = [[AVCaptureSession alloc]init];
[_session setSessionPreset:AVCaptureSessionPresetHigh];
if ([_session canAddInput:self.input])
{
[_session addInput:self.input];
}
if ([_session canAddOutput:self.output])
{
[_session addOutput:self.output];
}
AVCaptureConnection *outputConnection = [_output connectionWithMediaType:AVMediaTypeVideo];
outputConnection.videoOrientation = [QRUtil videoOrientationFromCurrentDeviceOrientation];
// 条码类型 AVMetadataObjectTypeQRCode
// _output.metadataObjectTypes =@[AVMetadataObjectTypeQRCode];
_output.metadataObjectTypes = @[AVMetadataObjectTypeEAN13Code,
AVMetadataObjectTypeEAN8Code,
AVMetadataObjectTypeCode128Code,
AVMetadataObjectTypeQRCode,
AVMetadataObjectTypeQRCode];
// Preview
_preview =[AVCaptureVideoPreviewLayer layerWithSession:_session];
_preview.videoGravity =AVLayerVideoGravityResize;
_preview.frame =[QRUtil screenBounds];
[self.view.layer insertSublayer:_preview atIndex:0];
_preview.connection.videoOrientation = [QRUtil videoOrientationFromCurrentDeviceOrientation];
[_session startRunning];
}
- (void)stopRunning {
[_preview removeFromSuperlayer];
[_session stopRunning];
}
//#pragma mark QRViewDelegate
//-(void)scanTypeConfig:(QRItem *)item {
//
// if (item.type == QRItemTypeQRCode) {
// _output.metadataObjectTypes =@[AVMetadataObjectTypeQRCode];
//
// } else if (item.type == QRItemTypeOther) {
//
// _output.metadataObjectTypes = @[AVMetadataObjectTypeEAN13Code,
// AVMetadataObjectTypeEAN8Code,
// AVMetadataObjectTypeCode128Code,
// AVMetadataObjectTypeQRCode,
// AVMetadataObjectTypeQRCode];
// }
//}
#pragma mark AVCaptureMetadataOutputObjectsDelegate
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection
{
NSString *stringValue = @"";
if ([metadataObjects count] >0)
{
//停止扫描
[_session stopRunning];
AVMetadataMachineReadableCodeObject * metadataObject = [metadataObjects objectAtIndex:0];
stringValue = metadataObject.stringValue;
}
self.urlString = stringValue;
NSLog(@" 扫描后的url是:%@",stringValue);
if (self.scanCompleteBlock) {
self.scanCompleteBlock(stringValue);
}
}
#pragma mark - Getter and Setter
-(UIButton *)backBtn {
if (!_backBtn) {
_backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_backBtn.frame = CGRectMake(50, ScreenHeight-80, 100, 50);
[_backBtn setTitle:@"取消扫描" forState:UIControlStateNormal];
[_backBtn addTarget:self action:@selector(pop:) forControlEvents:UIControlEventTouchUpInside];
}
return _backBtn;
}
-(QRView *)qrView {
if (!_qrView) {
CGRect screenRect = [QRUtil screenBounds];
_qrView = [[QRView alloc] initWithFrame:screenRect];
_qrView.transparentArea = CGSizeMake(400, 400);
_qrView.backgroundColor = [UIColor clearColor];
_qrView.delegate = self;
}
return _qrView;
}
#pragma mark -提示文本
- (UILabel *)Titlelabe
{
if (!_Titlelabe) {
_Titlelabe = [[UILabel alloc]initWithFrame:CGRectMake((ScreenWidth-400)/2, 120, 400, 50)];
_Titlelabe.text = @"将条形码/二维码放入框内,即可自动扫描";
_Titlelabe.font = [UIFont systemFontOfSize:20];
_Titlelabe.textColor = [UIColor whiteColor];
}
return _Titlelabe;
}
#pragma mark -指示器
- (UIImageView *)instructionsLine
{
if (!_instructionsLine) {
_instructionsLine = [[UIImageView alloc]initWithFrame:CGRectMake((ScreenWidth - self.qrView.transparentArea.width) / 2 +20, (ScreenHeight - self.qrView.transparentArea.height) / 2 +20, self.qrView.transparentArea.width-40, 15)];
_instructionsLine.image = TCImage(@"圆角矩形-5");
}
return _instructionsLine;
}
#pragma mark -指示器动画
- (CADisplayLink *)link {
if (!_link) {
_link = [CADisplayLink displayLinkWithTarget:self selector:@selector(LineAnimation)];
}
return _link;
}
#pragma mark - 线条运动的动画
- (void)LineAnimation {
if (_up == YES) {
CGFloat y = self.instructionsLine.frame.origin.y;
y += 3;
CGRect frame = self.instructionsLine.frame;
frame.origin.y = y;
self.instructionsLine.frame = frame;
if (y >= (ScreenHeight - self.qrView.transparentArea.height) / 2 +self.qrView.transparentArea.height-20) {
_up = NO;
}
}else{
CGFloat y = self.instructionsLine.frame.origin.y;
y -= 3;
CGRect frame = self.instructionsLine.frame;
frame.origin.y = y;
self.instructionsLine.frame = frame;;
if (y <= (ScreenHeight - self.qrView.transparentArea.height) / 2 +20) {
_up = YES;
}
}
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment