Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
Opple-iOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
Opple-iOS
Commits
4be36868
Commit
4be36868
authored
May 12, 2016
by
勾芒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caoyunxiao
parent
0889cec3
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1 addition
and
1025 deletions
+1
-1025
LoginViewController.m
Lighting/Class/Login/LoginViewController.m
+0
-3
ProductLibraryViewController.m
Lighting/Class/ProductLibraryViewController.m
+1
-18
CustomTabbarController.m
Lighting/Class/Tabbar/CustomTabbarController.m
+0
-1
project.pbxproj
Lighting/Lighting.xcodeproj/project.pbxproj
+0
-48
Info.plist
Lighting/Lighting/Info.plist
+0
-1
HMScanerCardViewController.h
Lighting/Tools/QRCode/HMScanerCardViewController.h
+0
-15
HMScanerCardViewController.m
Lighting/Tools/QRCode/HMScanerCardViewController.m
+0
-62
QRCodeScanLine@2x.png
Lighting/Tools/QRCode/HMScanner.bundle/QRCodeScanLine@2x.png
+0
-0
ScanQR1@2x.png
Lighting/Tools/QRCode/HMScanner.bundle/ScanQR1@2x.png
+0
-0
ScanQR2@2x.png
Lighting/Tools/QRCode/HMScanner.bundle/ScanQR2@2x.png
+0
-0
ScanQR3@2x.png
Lighting/Tools/QRCode/HMScanner.bundle/ScanQR3@2x.png
+0
-0
ScanQR4@2x.png
Lighting/Tools/QRCode/HMScanner.bundle/ScanQR4@2x.png
+0
-0
HMScanner.h
Lighting/Tools/QRCode/HMScanner.h
+0
-49
HMScanner.m
Lighting/Tools/QRCode/HMScanner.m
+0
-312
HMScannerBorder.h
Lighting/Tools/QRCode/HMScannerBorder.h
+0
-19
HMScannerBorder.m
Lighting/Tools/QRCode/HMScannerBorder.m
+0
-96
HMScannerController.h
Lighting/Tools/QRCode/HMScannerController.h
+0
-65
HMScannerController.m
Lighting/Tools/QRCode/HMScannerController.m
+0
-50
HMScannerMaskView.h
Lighting/Tools/QRCode/HMScannerMaskView.h
+0
-25
HMScannerMaskView.m
Lighting/Tools/QRCode/HMScannerMaskView.m
+0
-42
HMScannerViewController.h
Lighting/Tools/QRCode/HMScannerViewController.h
+0
-23
HMScannerViewController.m
Lighting/Tools/QRCode/HMScannerViewController.m
+0
-196
No files found.
Lighting/Class/Login/LoginViewController.m
View file @
4be36868
...
@@ -12,9 +12,6 @@
...
@@ -12,9 +12,6 @@
#import "authenticateView.h"
#import "authenticateView.h"
#import "FollowHeartViewController.h"
#import "FollowHeartViewController.h"
#import "HMScannerController.h"
@interface
LoginViewController
()
<
RightVCselectedDelegate
>
@interface
LoginViewController
()
<
RightVCselectedDelegate
>
@property
(
nonatomic
,
strong
)
MMDrawerController
*
drawerController
;
@property
(
nonatomic
,
strong
)
MMDrawerController
*
drawerController
;
...
...
Lighting/Class/ProductLibraryViewController.m
View file @
4be36868
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
#import "ScreeningView.h"
#import "ScreeningView.h"
#import "screeningFirstView.h"
#import "screeningFirstView.h"
#import "screeningSecondView.h"
#import "screeningSecondView.h"
#import "HMScannerController.h"
@interface
ProductLibraryViewController
()
<
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UIGestureRecognizerDelegate
,
ScreeningButtonClickdelegate
,
TableviewSelectedIndexdelegate
,
SelectedCollectionItemDelegate
>
@interface
ProductLibraryViewController
()
<
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UIGestureRecognizerDelegate
,
ScreeningButtonClickdelegate
,
TableviewSelectedIndexdelegate
,
SelectedCollectionItemDelegate
>
...
@@ -344,23 +343,7 @@
...
@@ -344,23 +343,7 @@
#pragma mark -筛选
#pragma mark -筛选
-
(
void
)
ScreeningButtonClick
-
(
void
)
ScreeningButtonClick
{
{
NSString
*
cardName
=
@"天涯刀哥 - 傅红雪"
;
UIImage
*
avatar
=
[
UIImage
imageNamed
:
@"1"
];
HMScannerController
*
scanner
=
[
HMScannerController
scannerWithCardName
:
cardName
avatar
:
avatar
completion
:^
(
NSString
*
stringValue
)
{
// self.scanResultLabel.text = stringValue;
NSLog
(
@"%@"
,
stringValue
);
}];
[
scanner
setTitleColor
:[
UIColor
whiteColor
]
tintColor
:[
UIColor
greenColor
]];
// [self showDetailViewController:scanner sender:nil];
[
self
presentViewController
:
scanner
animated
:
YES
completion
:
nil
];
// [self.navigationController pushViewController:scanner animated:YES];
return
;
self
.
screenView
=
[[[
NSBundle
mainBundle
]
loadNibNamed
:
@"ScreeningView"
owner
:
self
options
:
nil
]
firstObject
];
self
.
screenView
=
[[[
NSBundle
mainBundle
]
loadNibNamed
:
@"ScreeningView"
owner
:
self
options
:
nil
]
firstObject
];
self
.
screenView
.
frame
=
CGRectMake
(
0
,
0
,
ScreenWidth
,
ScreenHeight
);
self
.
screenView
.
frame
=
CGRectMake
(
0
,
0
,
ScreenWidth
,
ScreenHeight
);
...
...
Lighting/Class/Tabbar/CustomTabbarController.m
View file @
4be36868
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
#import "CustomerOrderViewController.h"
#import "CustomerOrderViewController.h"
#import "UserViewController.h"
#import "UserViewController.h"
#import "ChangePasswordViewController.h"
#import "ChangePasswordViewController.h"
#import "HMScannerController.h"
@interface
CustomTabbarController
()
<
TabbarButtonClickdelegate
,
ChangpasswordDelegate
,
CancelButtondelegate
>
@interface
CustomTabbarController
()
<
TabbarButtonClickdelegate
,
ChangpasswordDelegate
,
CancelButtondelegate
>
...
...
Lighting/Lighting.xcodeproj/project.pbxproj
View file @
4be36868
...
@@ -83,13 +83,6 @@
...
@@ -83,13 +83,6 @@
29BFBD8F1CE44BA900C238FB
/* goodsDetailsSectionview.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBD8E1CE44BA900C238FB
/* goodsDetailsSectionview.m */
;
};
29BFBD8F1CE44BA900C238FB
/* goodsDetailsSectionview.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBD8E1CE44BA900C238FB
/* goodsDetailsSectionview.m */
;
};
29BFBD911CE44BC200C238FB
/* goodsDetailsSectionview.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBD901CE44BC200C238FB
/* goodsDetailsSectionview.xib */
;
};
29BFBD911CE44BC200C238FB
/* goodsDetailsSectionview.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBD901CE44BC200C238FB
/* goodsDetailsSectionview.xib */
;
};
29BFBD981CE46FDA00C238FB
/* MyclientEntityModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBD971CE46FDA00C238FB
/* MyclientEntityModel.m */
;
};
29BFBD981CE46FDA00C238FB
/* MyclientEntityModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBD971CE46FDA00C238FB
/* MyclientEntityModel.m */
;
};
29BFBDAA1CE4905900C238FB
/* HMScanerCardViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBD9E1CE4905900C238FB
/* HMScanerCardViewController.m */
;
};
29BFBDAB1CE4905900C238FB
/* HMScanner.bundle in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBD9F1CE4905900C238FB
/* HMScanner.bundle */
;
};
29BFBDAC1CE4905900C238FB
/* HMScanner.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBDA11CE4905900C238FB
/* HMScanner.m */
;
};
29BFBDAD1CE4905900C238FB
/* HMScannerBorder.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBDA31CE4905900C238FB
/* HMScannerBorder.m */
;
};
29BFBDAE1CE4905900C238FB
/* HMScannerController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBDA51CE4905900C238FB
/* HMScannerController.m */
;
};
29BFBDAF1CE4905900C238FB
/* HMScannerMaskView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBDA71CE4905900C238FB
/* HMScannerMaskView.m */
;
};
29BFBDB01CE4905900C238FB
/* HMScannerViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29BFBDA91CE4905900C238FB
/* HMScannerViewController.m */
;
};
29C584E91CDA249300C6F677
/* ProductCollectionViewCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29C584E81CDA249200C6F677
/* ProductCollectionViewCell.m */
;
};
29C584E91CDA249300C6F677
/* ProductCollectionViewCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29C584E81CDA249200C6F677
/* ProductCollectionViewCell.m */
;
};
29C584ED1CDA429500C6F677
/* ProductDetailsViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29C584EC1CDA429500C6F677
/* ProductDetailsViewController.m */
;
};
29C584ED1CDA429500C6F677
/* ProductDetailsViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29C584EC1CDA429500C6F677
/* ProductDetailsViewController.m */
;
};
29E28CE81CE0B91B00812A55
/* HENLENSONG.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29E28CE71CE0B91B00812A55
/* HENLENSONG.m */
;
};
29E28CE81CE0B91B00812A55
/* HENLENSONG.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
29E28CE71CE0B91B00812A55
/* HENLENSONG.m */
;
};
...
@@ -249,19 +242,6 @@
...
@@ -249,19 +242,6 @@
29BFBD901CE44BC200C238FB
/* goodsDetailsSectionview.xib */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.xib
;
path
=
goodsDetailsSectionview.xib
;
sourceTree
=
"<group>"
;
};
29BFBD901CE44BC200C238FB
/* goodsDetailsSectionview.xib */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.xib
;
path
=
goodsDetailsSectionview.xib
;
sourceTree
=
"<group>"
;
};
29BFBD961CE46FDA00C238FB
/* MyclientEntityModel.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
MyclientEntityModel.h
;
sourceTree
=
"<group>"
;
};
29BFBD961CE46FDA00C238FB
/* MyclientEntityModel.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
MyclientEntityModel.h
;
sourceTree
=
"<group>"
;
};
29BFBD971CE46FDA00C238FB
/* MyclientEntityModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
MyclientEntityModel.m
;
sourceTree
=
"<group>"
;
};
29BFBD971CE46FDA00C238FB
/* MyclientEntityModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
MyclientEntityModel.m
;
sourceTree
=
"<group>"
;
};
29BFBD9D1CE4905900C238FB
/* HMScanerCardViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HMScanerCardViewController.h
;
sourceTree
=
"<group>"
;
};
29BFBD9E1CE4905900C238FB
/* HMScanerCardViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HMScanerCardViewController.m
;
sourceTree
=
"<group>"
;
};
29BFBD9F1CE4905900C238FB
/* HMScanner.bundle */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"wrapper.plug-in"
;
path
=
HMScanner.bundle
;
sourceTree
=
"<group>"
;
};
29BFBDA01CE4905900C238FB
/* HMScanner.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HMScanner.h
;
sourceTree
=
"<group>"
;
};
29BFBDA11CE4905900C238FB
/* HMScanner.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HMScanner.m
;
sourceTree
=
"<group>"
;
};
29BFBDA21CE4905900C238FB
/* HMScannerBorder.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HMScannerBorder.h
;
sourceTree
=
"<group>"
;
};
29BFBDA31CE4905900C238FB
/* HMScannerBorder.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HMScannerBorder.m
;
sourceTree
=
"<group>"
;
};
29BFBDA41CE4905900C238FB
/* HMScannerController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HMScannerController.h
;
sourceTree
=
"<group>"
;
};
29BFBDA51CE4905900C238FB
/* HMScannerController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HMScannerController.m
;
sourceTree
=
"<group>"
;
};
29BFBDA61CE4905900C238FB
/* HMScannerMaskView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HMScannerMaskView.h
;
sourceTree
=
"<group>"
;
};
29BFBDA71CE4905900C238FB
/* HMScannerMaskView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HMScannerMaskView.m
;
sourceTree
=
"<group>"
;
};
29BFBDA81CE4905900C238FB
/* HMScannerViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
HMScannerViewController.h
;
sourceTree
=
"<group>"
;
};
29BFBDA91CE4905900C238FB
/* HMScannerViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
HMScannerViewController.m
;
sourceTree
=
"<group>"
;
};
29C584E71CDA249200C6F677
/* ProductCollectionViewCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ProductCollectionViewCell.h
;
sourceTree
=
"<group>"
;
};
29C584E71CDA249200C6F677
/* ProductCollectionViewCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ProductCollectionViewCell.h
;
sourceTree
=
"<group>"
;
};
29C584E81CDA249200C6F677
/* ProductCollectionViewCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ProductCollectionViewCell.m
;
sourceTree
=
"<group>"
;
};
29C584E81CDA249200C6F677
/* ProductCollectionViewCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ProductCollectionViewCell.m
;
sourceTree
=
"<group>"
;
};
29C584EB1CDA429500C6F677
/* ProductDetailsViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ProductDetailsViewController.h
;
sourceTree
=
"<group>"
;
};
29C584EB1CDA429500C6F677
/* ProductDetailsViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ProductDetailsViewController.h
;
sourceTree
=
"<group>"
;
};
...
@@ -430,7 +410,6 @@
...
@@ -430,7 +410,6 @@
2928F7DE1CD085430036D761
/* Tools */
=
{
2928F7DE1CD085430036D761
/* Tools */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
29BFBD9C1CE4905900C238FB
/* QRCode */
,
29BFBD841CE4288A00C238FB
/* Customercenter */
,
29BFBD841CE4288A00C238FB
/* Customercenter */
,
29F725F81CE17AE40072FE0E
/* Shopperscenter */
,
29F725F81CE17AE40072FE0E
/* Shopperscenter */
,
29E28CE51CE0B90600812A55
/* Regularexpressions */
,
29E28CE51CE0B90600812A55
/* Regularexpressions */
,
...
@@ -852,26 +831,6 @@
...
@@ -852,26 +831,6 @@
name
=
model
;
name
=
model
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
29BFBD9C1CE4905900C238FB
/* QRCode */
=
{
isa
=
PBXGroup
;
children
=
(
29BFBD9D1CE4905900C238FB
/* HMScanerCardViewController.h */
,
29BFBD9E1CE4905900C238FB
/* HMScanerCardViewController.m */
,
29BFBD9F1CE4905900C238FB
/* HMScanner.bundle */
,
29BFBDA01CE4905900C238FB
/* HMScanner.h */
,
29BFBDA11CE4905900C238FB
/* HMScanner.m */
,
29BFBDA21CE4905900C238FB
/* HMScannerBorder.h */
,
29BFBDA31CE4905900C238FB
/* HMScannerBorder.m */
,
29BFBDA41CE4905900C238FB
/* HMScannerController.h */
,
29BFBDA51CE4905900C238FB
/* HMScannerController.m */
,
29BFBDA61CE4905900C238FB
/* HMScannerMaskView.h */
,
29BFBDA71CE4905900C238FB
/* HMScannerMaskView.m */
,
29BFBDA81CE4905900C238FB
/* HMScannerViewController.h */
,
29BFBDA91CE4905900C238FB
/* HMScannerViewController.m */
,
);
path
=
QRCode
;
sourceTree
=
"<group>"
;
};
29C584E51CDA246900C6F677
/* controller */
=
{
29C584E51CDA246900C6F677
/* controller */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -1123,7 +1082,6 @@
...
@@ -1123,7 +1082,6 @@
29706DAF1CD082990003C412
/* Main.storyboard in Resources */
,
29706DAF1CD082990003C412
/* Main.storyboard in Resources */
,
29EC331B1CE023D5005F0C13
/* ChangePasswordViewController.xib in Resources */
,
29EC331B1CE023D5005F0C13
/* ChangePasswordViewController.xib in Resources */
,
29360C311CDDC487002A5D89
/* ScreeningView.xib in Resources */
,
29360C311CDDC487002A5D89
/* ScreeningView.xib in Resources */
,
29BFBDAB1CE4905900C238FB
/* HMScanner.bundle in Resources */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
@@ -1184,13 +1142,11 @@
...
@@ -1184,13 +1142,11 @@
files
=
(
files
=
(
29BFBD981CE46FDA00C238FB
/* MyclientEntityModel.m in Sources */
,
29BFBD981CE46FDA00C238FB
/* MyclientEntityModel.m in Sources */
,
29F726041CE1E96E0072FE0E
/* ScreeningSecondCollectionReusableView.m in Sources */
,
29F726041CE1E96E0072FE0E
/* ScreeningSecondCollectionReusableView.m in Sources */
,
29BFBDB01CE4905900C238FB
/* HMScannerViewController.m in Sources */
,
04A14A281CE0FC5600DAD5F3
/* RightSubView.m in Sources */
,
04A14A281CE0FC5600DAD5F3
/* RightSubView.m in Sources */
,
29EC331F1CE02AFA005F0C13
/* PopoverViewController.m in Sources */
,
29EC331F1CE02AFA005F0C13
/* PopoverViewController.m in Sources */
,
29BFBD871CE428B200C238FB
/* Customermanager.m in Sources */
,
29BFBD871CE428B200C238FB
/* Customermanager.m in Sources */
,
299C7F5A1CE21FA800E7D7CB
/* AddressViewController.m in Sources */
,
299C7F5A1CE21FA800E7D7CB
/* AddressViewController.m in Sources */
,
29BB276C1CD9DE74009A0813
/* FollowHeartViewController.m in Sources */
,
29BB276C1CD9DE74009A0813
/* FollowHeartViewController.m in Sources */
,
29BFBDAD1CE4905900C238FB
/* HMScannerBorder.m in Sources */
,
2928F8381CD09E730036D761
/* CustomButton.m in Sources */
,
2928F8381CD09E730036D761
/* CustomButton.m in Sources */
,
0470D6111CE2936000647F0F
/* SeceneLibraryView.m in Sources */
,
0470D6111CE2936000647F0F
/* SeceneLibraryView.m in Sources */
,
2998763F1CD9985B00C90D0A
/* AttachmentInformationTableViewCell.m in Sources */
,
2998763F1CD9985B00C90D0A
/* AttachmentInformationTableViewCell.m in Sources */
,
...
@@ -1207,7 +1163,6 @@
...
@@ -1207,7 +1163,6 @@
2928F7E71CD087FE0036D761
/* BaseViewController.m in Sources */
,
2928F7E71CD087FE0036D761
/* BaseViewController.m in Sources */
,
299876271CD9837C00C90D0A
/* OrderTableViewCell.m in Sources */
,
299876271CD9837C00C90D0A
/* OrderTableViewCell.m in Sources */
,
2998763C1CD9983A00C90D0A
/* CommodityListTableViewCell.m in Sources */
,
2998763C1CD9983A00C90D0A
/* CommodityListTableViewCell.m in Sources */
,
29BFBDAA1CE4905900C238FB
/* HMScanerCardViewController.m in Sources */
,
2962D0791CD1CBC60058829D
/* NetworkRequestClassManager.m in Sources */
,
2962D0791CD1CBC60058829D
/* NetworkRequestClassManager.m in Sources */
,
29F725FB1CE17B0D0072FE0E
/* Shoppersmanager.m in Sources */
,
29F725FB1CE17B0D0072FE0E
/* Shoppersmanager.m in Sources */
,
29EAAEA01CDC79DC00C4DBA2
/* CustomerOrderViewController.m in Sources */
,
29EAAEA01CDC79DC00C4DBA2
/* CustomerOrderViewController.m in Sources */
,
...
@@ -1220,7 +1175,6 @@
...
@@ -1220,7 +1175,6 @@
29360C2F1CDDC47E002A5D89
/* ScreeningView.m in Sources */
,
29360C2F1CDDC47E002A5D89
/* ScreeningView.m in Sources */
,
29EAAE9C1CDC74CA00C4DBA2
/* AllCustomerViewController.m in Sources */
,
29EAAE9C1CDC74CA00C4DBA2
/* AllCustomerViewController.m in Sources */
,
04A14A2B1CE0FC7F00DAD5F3
/* FootSubView.m in Sources */
,
04A14A2B1CE0FC7F00DAD5F3
/* FootSubView.m in Sources */
,
29BFBDAE1CE4905900C238FB
/* HMScannerController.m in Sources */
,
2933934F1CD3158B000D997B
/* instructionsLabe.m in Sources */
,
2933934F1CD3158B000D997B
/* instructionsLabe.m in Sources */
,
29F726011CE1D05D0072FE0E
/* ScreeningCollectionReusableView.m in Sources */
,
29F726011CE1D05D0072FE0E
/* ScreeningCollectionReusableView.m in Sources */
,
29C584E91CDA249300C6F677
/* ProductCollectionViewCell.m in Sources */
,
29C584E91CDA249300C6F677
/* ProductCollectionViewCell.m in Sources */
,
...
@@ -1234,7 +1188,6 @@
...
@@ -1234,7 +1188,6 @@
299876421CD99E4000C90D0A
/* OrderdetailsViewController.m in Sources */
,
299876421CD99E4000C90D0A
/* OrderdetailsViewController.m in Sources */
,
29EC331A1CE023D5005F0C13
/* ChangePasswordViewController.m in Sources */
,
29EC331A1CE023D5005F0C13
/* ChangePasswordViewController.m in Sources */
,
2962D07D1CD1E4490058829D
/* NSArray+Objectwithindex.m in Sources */
,
2962D07D1CD1E4490058829D
/* NSArray+Objectwithindex.m in Sources */
,
29BFBDAF1CE4905900C238FB
/* HMScannerMaskView.m in Sources */
,
04A14A251CE0FC3A00DAD5F3
/* LeftSubView.m in Sources */
,
04A14A251CE0FC3A00DAD5F3
/* LeftSubView.m in Sources */
,
299876391CD9981800C90D0A
/* GoodsInformationTableViewCell.m in Sources */
,
299876391CD9981800C90D0A
/* GoodsInformationTableViewCell.m in Sources */
,
2949BABD1CD2EFA00049385A
/* InformationTableViewCell.m in Sources */
,
2949BABD1CD2EFA00049385A
/* InformationTableViewCell.m in Sources */
,
...
@@ -1259,7 +1212,6 @@
...
@@ -1259,7 +1212,6 @@
29834EC01CDF5E4E001A484F
/* ScreeningFirstCollectionViewCell.m in Sources */
,
29834EC01CDF5E4E001A484F
/* ScreeningFirstCollectionViewCell.m in Sources */
,
29834EC51CDF76C1001A484F
/* UserViewController.m in Sources */
,
29834EC51CDF76C1001A484F
/* UserViewController.m in Sources */
,
29BB277D1CD9DFCB009A0813
/* CustomerManagementViewController.m in Sources */
,
29BB277D1CD9DFCB009A0813
/* CustomerManagementViewController.m in Sources */
,
29BFBDAC1CE4905900C238FB
/* HMScanner.m in Sources */
,
2962D06D1CD1A43A0058829D
/* ClientViewController.m in Sources */
,
2962D06D1CD1A43A0058829D
/* ClientViewController.m in Sources */
,
29A8D3981CD85A58004D558F
/* ClientdetailsViewController.m in Sources */
,
29A8D3981CD85A58004D558F
/* ClientdetailsViewController.m in Sources */
,
);
);
...
...
Lighting/Lighting/Info.plist
View file @
4be36868
...
@@ -43,7 +43,6 @@
...
@@ -43,7 +43,6 @@
<
a
rr
a
y
>
<
a
rr
a
y
>
<
string
>
UIInterfaceOrientationLandscapeLeft
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeLeft
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeRight
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeRight
<
/string
>
<
string
>
UIInterfaceOrientationPortrait
<
/string
>
<
/
a
rr
a
y
>
<
/
a
rr
a
y
>
<
k
e
y
>
UIViewControllerBasedStatusBarAppearance
<
/k
e
y
>
<
k
e
y
>
UIViewControllerBasedStatusBarAppearance
<
/k
e
y
>
<
fa
ls
e
/
>
<
fa
ls
e
/
>
...
...
Lighting/Tools/QRCode/HMScanerCardViewController.h
deleted
100755 → 0
View file @
0889cec3
//
// HMScanerCardViewController.h
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/3.
// Copyright © 2016年 itheima. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface
HMScanerCardViewController
:
UIViewController
-
(
instancetype
)
initWithCardName
:(
NSString
*
)
cardName
avatar
:(
UIImage
*
)
avatar
;
@end
Lighting/Tools/QRCode/HMScanerCardViewController.m
deleted
100755 → 0
View file @
0889cec3
//
// HMScanerCardViewController.m
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/3.
// Copyright © 2016年 itheima. All rights reserved.
//
#import "HMScanerCardViewController.h"
#import "HMScanner.h"
@interface
HMScanerCardViewController
()
/// 名片字符串
@property
(
nonatomic
)
NSString
*
cardName
;
/// 头像图片
@property
(
nonatomic
)
UIImage
*
avatar
;
@end
@implementation
HMScanerCardViewController
{
UIImageView
*
cardImageView
;
}
#pragma mark - 构造函数
-
(
instancetype
)
initWithCardName
:
(
NSString
*
)
cardName
avatar
:
(
UIImage
*
)
avatar
{
self
=
[
super
init
];
if
(
self
)
{
self
.
cardName
=
cardName
;
self
.
avatar
=
avatar
;
}
return
self
;
}
#pragma mark - 设置界面
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
view
.
backgroundColor
=
[
UIColor
darkGrayColor
];
[
self
prepareNavigationBar
];
CGFloat
width
=
self
.
view
.
bounds
.
size
.
width
-
80
;
cardImageView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
width
,
width
)];
cardImageView
.
center
=
self
.
view
.
center
;
[
self
.
view
addSubview
:
cardImageView
];
[
HMScanner
qrImageWithString
:
self
.
cardName
avatar
:
self
.
avatar
completion
:^
(
UIImage
*
image
)
{
cardImageView
.
image
=
image
;
}];
}
/// 准备导航栏
-
(
void
)
prepareNavigationBar
{
// 1> 背景颜色
[
self
.
navigationController
.
navigationBar
setBarTintColor
:[
UIColor
colorWithWhite
:
0
.
1
alpha
:
1
.
0
]];
self
.
navigationController
.
navigationBar
.
translucent
=
YES
;
self
.
navigationController
.
navigationBar
.
shadowImage
=
[[
UIImage
alloc
]
init
];
// 2> 标题
self
.
title
=
@"我的名片"
;
}
@end
Lighting/Tools/QRCode/HMScanner.bundle/QRCodeScanLine@2x.png
deleted
100755 → 0
View file @
0889cec3
1.24 KB
Lighting/Tools/QRCode/HMScanner.bundle/ScanQR1@2x.png
deleted
100755 → 0
View file @
0889cec3
106 Bytes
Lighting/Tools/QRCode/HMScanner.bundle/ScanQR2@2x.png
deleted
100755 → 0
View file @
0889cec3
106 Bytes
Lighting/Tools/QRCode/HMScanner.bundle/ScanQR3@2x.png
deleted
100755 → 0
View file @
0889cec3
106 Bytes
Lighting/Tools/QRCode/HMScanner.bundle/ScanQR4@2x.png
deleted
100755 → 0
View file @
0889cec3
106 Bytes
Lighting/Tools/QRCode/HMScanner.h
deleted
100755 → 0
View file @
0889cec3
//
// HMScanner.h
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/2.
// Copyright © 2016年 itheima. All rights reserved.
//
#import <UIKit/UIKit.h>
/// 二维码/条码扫描器
@interface
HMScanner
:
NSObject
/// 使用视图实例化扫描器,扫描预览窗口会添加到指定视图中
///
/// @param view 指定的视图
/// @param scanFrame 扫描范围
/// @param completion 完成回调
///
/// @return 扫描器
+
(
instancetype
)
scanerWithView
:(
UIView
*
)
view
scanFrame
:(
CGRect
)
scanFrame
completion
:(
void
(
^
)(
NSString
*
stringValue
))
completion
;
/// 扫描图像
///
/// @param image 包含二维码的图像
/// @remark 目前只支持 64 位的 iOS 设备
+
(
void
)
scaneImage
:(
UIImage
*
)
image
completion
:(
void
(
^
)(
NSArray
*
values
))
completion
;
/// 使用 string / 头像 异步生成二维码图像
///
/// @param string 二维码图像的字符串
/// @param avatar 头像图像,默认比例 0.2
/// @param completion 完成回调
+
(
void
)
qrImageWithString
:(
NSString
*
)
string
avatar
:(
UIImage
*
)
avatar
completion
:(
void
(
^
)(
UIImage
*
image
))
completion
;
/// 使用 string / 头像 异步生成二维码图像,并且指定头像占二维码图像的比例
///
/// @param string 二维码图像的字符串
/// @param avatar 头像图像
/// @param scale 头像占二维码图像的比例
/// @param completion 完成回调
+
(
void
)
qrImageWithString
:(
NSString
*
)
string
avatar
:(
UIImage
*
)
avatar
scale
:(
CGFloat
)
scale
completion
:(
void
(
^
)(
UIImage
*
))
completion
;
/// 开始扫描
-
(
void
)
startScan
;
/// 停止扫描
-
(
void
)
stopScan
;
@end
Lighting/Tools/QRCode/HMScanner.m
deleted
100755 → 0
View file @
0889cec3
//
// HMScanner.m
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/2.
// Copyright © 2016年 itheima. All rights reserved.
//
#import "HMScanner.h"
#import <AVFoundation/AVFoundation.h>
/// 最大检测次数
#define kMaxDetectedCount 20
@interface
HMScanner
()
<
AVCaptureMetadataOutputObjectsDelegate
>
/// 父视图弱引用
@property
(
nonatomic
,
weak
)
UIView
*
parentView
;
/// 扫描范围
@property
(
nonatomic
)
CGRect
scanFrame
;
/// 完成回调
@property
(
nonatomic
,
copy
)
void
(
^
completionCallBack
)(
NSString
*
);
@end
@implementation
HMScanner
{
/// 拍摄会话
AVCaptureSession
*
session
;
/// 预览图层
AVCaptureVideoPreviewLayer
*
previewLayer
;
/// 绘制图层
CALayer
*
drawLayer
;
/// 当前检测计数
NSInteger
currentDetectedCount
;
}
#pragma mark - 生成二维码
+
(
void
)
qrImageWithString
:
(
NSString
*
)
string
avatar
:
(
UIImage
*
)
avatar
completion
:
(
void
(
^
)(
UIImage
*
))
completion
{
[
self
qrImageWithString
:
string
avatar
:
avatar
scale
:
0
.
20
completion
:
completion
];
}
+
(
void
)
qrImageWithString
:
(
NSString
*
)
string
avatar
:
(
UIImage
*
)
avatar
scale
:
(
CGFloat
)
scale
completion
:
(
void
(
^
)(
UIImage
*
))
completion
{
NSAssert
(
completion
!=
nil
,
@"必须传入完成回调"
);
dispatch_async
(
dispatch_get_global_queue
(
0
,
0
),
^
{
CIFilter
*
qrFilter
=
[
CIFilter
filterWithName
:
@"CIQRCodeGenerator"
];
[
qrFilter
setDefaults
];
[
qrFilter
setValue
:[
string
dataUsingEncoding
:
NSUTF8StringEncoding
]
forKey
:
@"inputMessage"
];
CIImage
*
ciImage
=
qrFilter
.
outputImage
;
CGAffineTransform
transform
=
CGAffineTransformMakeScale
(
10
,
10
);
CIImage
*
transformedImage
=
[
ciImage
imageByApplyingTransform
:
transform
];
CIContext
*
context
=
[
CIContext
contextWithOptions
:
nil
];
CGImageRef
cgImage
=
[
context
createCGImage
:
transformedImage
fromRect
:
transformedImage
.
extent
];
UIImage
*
qrImage
=
[
UIImage
imageWithCGImage
:
cgImage
scale
:[
UIScreen
mainScreen
].
scale
orientation
:
UIImageOrientationUp
];
CGImageRelease
(
cgImage
);
if
(
avatar
!=
nil
)
{
qrImage
=
[
self
qrcodeImage
:
qrImage
addAvatar
:
avatar
scale
:
scale
];
}
dispatch_async
(
dispatch_get_main_queue
(),
^
{
completion
(
qrImage
);
});
});
}
+
(
UIImage
*
)
qrcodeImage
:
(
UIImage
*
)
qrImage
addAvatar
:
(
UIImage
*
)
avatar
scale
:
(
CGFloat
)
scale
{
CGFloat
screenScale
=
[
UIScreen
mainScreen
].
scale
;
CGRect
rect
=
CGRectMake
(
0
,
0
,
qrImage
.
size
.
width
*
screenScale
,
qrImage
.
size
.
height
*
screenScale
);
UIGraphicsBeginImageContextWithOptions
(
rect
.
size
,
YES
,
screenScale
);
[
qrImage
drawInRect
:
rect
];
CGSize
avatarSize
=
CGSizeMake
(
rect
.
size
.
width
*
scale
,
rect
.
size
.
height
*
scale
);
CGFloat
x
=
(
rect
.
size
.
width
-
avatarSize
.
width
)
*
0
.
5
;
CGFloat
y
=
(
rect
.
size
.
height
-
avatarSize
.
height
)
*
0
.
5
;
[
avatar
drawInRect
:
CGRectMake
(
x
,
y
,
avatarSize
.
width
,
avatarSize
.
height
)];
UIImage
*
result
=
UIGraphicsGetImageFromCurrentImageContext
();
UIGraphicsEndImageContext
();
return
[
UIImage
imageWithCGImage
:
result
.
CGImage
scale
:
screenScale
orientation
:
UIImageOrientationUp
];
}
#pragma mark - 扫描图像方法
+
(
void
)
scaneImage
:
(
UIImage
*
)
image
completion
:
(
void
(
^
)(
NSArray
*
))
completion
{
NSAssert
(
completion
!=
nil
,
@"必须传入完成回调"
);
dispatch_async
(
dispatch_get_global_queue
(
0
,
0
),
^
{
CIDetector
*
detector
=
[
CIDetector
detectorOfType
:
CIDetectorTypeQRCode
context
:
nil
options
:
@{
CIDetectorAccuracy
:
CIDetectorAccuracyHigh
}];
CIImage
*
ciImage
=
[[
CIImage
alloc
]
initWithImage
:
image
];
NSArray
*
features
=
[
detector
featuresInImage
:
ciImage
];
NSMutableArray
*
arrayM
=
[
NSMutableArray
arrayWithCapacity
:
features
.
count
];
for
(
CIQRCodeFeature
*
feature
in
features
)
{
[
arrayM
addObject
:
feature
.
messageString
];
}
dispatch_async
(
dispatch_get_main_queue
(),
^
{
completion
(
arrayM
.
copy
);
});
});
}
#pragma mark - 构造函数
+
(
instancetype
)
scanerWithView
:
(
UIView
*
)
view
scanFrame
:
(
CGRect
)
scanFrame
completion
:
(
void
(
^
)(
NSString
*
))
completion
{
NSAssert
(
completion
!=
nil
,
@"必须传入完成回调"
);
return
[[
self
alloc
]
initWithView
:
view
scanFrame
:
scanFrame
completion
:
completion
];
}
-
(
instancetype
)
initWithView
:
(
UIView
*
)
view
scanFrame
:
(
CGRect
)
scanFrame
completion
:
(
void
(
^
)(
NSString
*
))
completion
{
self
=
[
super
init
];
if
(
self
)
{
self
.
parentView
=
view
;
self
.
scanFrame
=
scanFrame
;
self
.
completionCallBack
=
completion
;
[
self
setupSession
];
}
return
self
;
}
#pragma mark - 公共方法
/// 开始扫描
-
(
void
)
startScan
{
if
([
session
isRunning
])
{
return
;
}
currentDetectedCount
=
0
;
[
session
startRunning
];
}
-
(
void
)
stopScan
{
if
(
!
[
session
isRunning
])
{
return
;
}
[
session
stopRunning
];
}
#pragma mark - AVCaptureMetadataOutputObjectsDelegate
-
(
void
)
captureOutput
:
(
AVCaptureOutput
*
)
captureOutput
didOutputMetadataObjects
:
(
NSArray
*
)
metadataObjects
fromConnection
:
(
AVCaptureConnection
*
)
connection
{
[
self
clearDrawLayer
];
for
(
id
obj
in
metadataObjects
)
{
// 判断检测到的对象类型
if
(
!
[
obj
isKindOfClass
:[
AVMetadataMachineReadableCodeObject
class
]])
{
return
;
}
// 转换对象坐标
AVMetadataMachineReadableCodeObject
*
dataObject
=
(
AVMetadataMachineReadableCodeObject
*
)[
previewLayer
transformedMetadataObjectForMetadataObject
:
obj
];
// 判断扫描范围
if
(
!
CGRectContainsRect
(
self
.
scanFrame
,
dataObject
.
bounds
))
{
continue
;
}
if
(
currentDetectedCount
++
<
kMaxDetectedCount
)
{
// 绘制边角
[
self
drawCornersShape
:
dataObject
];
}
else
{
[
self
stopScan
];
// 完成回调
if
(
self
.
completionCallBack
!=
nil
)
{
self
.
completionCallBack
(
dataObject
.
stringValue
);
}
}
}
}
/// 清空绘制图层
-
(
void
)
clearDrawLayer
{
if
(
drawLayer
.
sublayers
.
count
==
0
)
{
return
;
}
[
drawLayer
.
sublayers
makeObjectsPerformSelector
:
@selector
(
removeFromSuperlayer
)];
}
/// 绘制条码形状
///
/// @param dataObject 识别到的数据对象
-
(
void
)
drawCornersShape
:
(
AVMetadataMachineReadableCodeObject
*
)
dataObject
{
if
(
dataObject
.
corners
.
count
==
0
)
{
return
;
}
CAShapeLayer
*
layer
=
[
CAShapeLayer
layer
];
layer
.
lineWidth
=
4
;
layer
.
strokeColor
=
[
UIColor
greenColor
].
CGColor
;
layer
.
fillColor
=
[
UIColor
clearColor
].
CGColor
;
layer
.
path
=
[
self
cornersPath
:
dataObject
.
corners
];
[
drawLayer
addSublayer
:
layer
];
}
/// 使用 corners 数组生成绘制路径
///
/// @param corners corners 数组
///
/// @return 绘制路径
-
(
CGPathRef
)
cornersPath
:
(
NSArray
*
)
corners
{
UIBezierPath
*
path
=
[
UIBezierPath
bezierPath
];
CGPoint
point
=
CGPointZero
;
// 1. 移动到第一个点
NSInteger
index
=
0
;
CGPointMakeWithDictionaryRepresentation
((
CFDictionaryRef
)
corners
[
index
++
],
&
point
);
[
path
moveToPoint
:
point
];
// 2. 遍历剩余的点
while
(
index
<
corners
.
count
)
{
CGPointMakeWithDictionaryRepresentation
((
CFDictionaryRef
)
corners
[
index
++
],
&
point
);
[
path
addLineToPoint
:
point
];
}
// 3. 关闭路径
[
path
closePath
];
return
path
.
CGPath
;
}
#pragma mark - 扫描相关方法
/// 设置绘制图层和预览图层
-
(
void
)
setupLayers
{
if
(
self
.
parentView
==
nil
)
{
NSLog
(
@"父视图不存在"
);
return
;
}
if
(
session
==
nil
)
{
NSLog
(
@"拍摄会话不存在"
);
return
;
}
// 绘制图层
drawLayer
=
[
CALayer
layer
];
drawLayer
.
frame
=
self
.
parentView
.
bounds
;
[
self
.
parentView
.
layer
insertSublayer
:
drawLayer
atIndex
:
0
];
// 预览图层
previewLayer
=
[[
AVCaptureVideoPreviewLayer
alloc
]
initWithSession
:
session
];
previewLayer
.
videoGravity
=
AVLayerVideoGravityResizeAspectFill
;
previewLayer
.
frame
=
self
.
parentView
.
bounds
;
[
self
.
parentView
.
layer
insertSublayer
:
previewLayer
atIndex
:
0
];
}
/// 设置扫描会话
-
(
void
)
setupSession
{
// 1> 输入设备
AVCaptureDevice
*
device
=
[
AVCaptureDevice
defaultDeviceWithMediaType
:
AVMediaTypeVideo
];
AVCaptureDeviceInput
*
videoInput
=
[
AVCaptureDeviceInput
deviceInputWithDevice
:
device
error
:
nil
];
if
(
videoInput
==
nil
)
{
NSLog
(
@"创建输入设备失败"
);
return
;
}
// 2> 数据输出
AVCaptureMetadataOutput
*
dataOutput
=
[[
AVCaptureMetadataOutput
alloc
]
init
];
// 3> 拍摄会话 - 判断能够添加设备
session
=
[[
AVCaptureSession
alloc
]
init
];
if
(
!
[
session
canAddInput
:
videoInput
])
{
NSLog
(
@"无法添加输入设备"
);
session
=
nil
;
return
;
}
if
(
!
[
session
canAddOutput
:
dataOutput
])
{
NSLog
(
@"无法添加输入设备"
);
session
=
nil
;
return
;
}
// 4> 添加输入/输出设备
[
session
addInput
:
videoInput
];
[
session
addOutput
:
dataOutput
];
// 5> 设置扫描类型
dataOutput
.
metadataObjectTypes
=
dataOutput
.
availableMetadataObjectTypes
;
[
dataOutput
setMetadataObjectsDelegate
:
self
queue
:
dispatch_get_main_queue
()];
// 6> 设置预览图层会话
[
self
setupLayers
];
}
@end
Lighting/Tools/QRCode/HMScannerBorder.h
deleted
100755 → 0
View file @
0889cec3
//
// HMScannerBorder.h
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/2.
// Copyright © 2016年 itheima. All rights reserved.
//
#import <UIKit/UIKit.h>
/// 扫描框视图
@interface
HMScannerBorder
:
UIView
/// 开始扫描动画
-
(
void
)
startScannerAnimating
;
/// 停止扫描动画
-
(
void
)
stopScannerAnimating
;
@end
Lighting/Tools/QRCode/HMScannerBorder.m
deleted
100755 → 0
View file @
0889cec3
//
// HMScannerBorder.m
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/2.
// Copyright © 2016年 itheima. All rights reserved.
//
#import "HMScannerBorder.h"
@implementation
HMScannerBorder
{
/// 冲击波图像
UIImageView
*
scannerLine
;
}
-
(
instancetype
)
initWithFrame
:
(
CGRect
)
frame
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
[
self
prepareUI
];
}
return
self
;
}
#pragma mark - 扫描动画方法
/// 开始扫描动画
-
(
void
)
startScannerAnimating
{
[
self
stopScannerAnimating
];
[
UIView
animateWithDuration
:
3
.
0
delay
:
0
.
0
options
:
UIViewAnimationOptionCurveEaseInOut
animations
:^
{
[
UIView
setAnimationRepeatCount
:
MAXFLOAT
];
scannerLine
.
center
=
CGPointMake
(
self
.
bounds
.
size
.
width
*
0
.
5
,
self
.
bounds
.
size
.
height
);
}
completion
:
nil
];
}
/// 停止扫描动画
-
(
void
)
stopScannerAnimating
{
[
scannerLine
.
layer
removeAllAnimations
];
scannerLine
.
center
=
CGPointMake
(
self
.
bounds
.
size
.
width
*
0
.
5
,
0
);
}
#pragma mark - 设置界面
-
(
void
)
prepareUI
{
self
.
clipsToBounds
=
YES
;
// 图像文件包
NSBundle
*
bundle
=
[
NSBundle
bundleForClass
:[
self
class
]];
NSURL
*
url
=
[
bundle
URLForResource
:
@"HMScanner"
withExtension
:
@"bundle"
];
NSBundle
*
imageBundle
=
[
NSBundle
bundleWithURL
:
url
];
// 冲击波图像
scannerLine
=
[[
UIImageView
alloc
]
initWithImage
:[
self
imageWithName
:
@"QRCodeScanLine"
bundle
:
imageBundle
]];
scannerLine
.
frame
=
CGRectMake
(
0
,
0
,
self
.
bounds
.
size
.
width
,
scannerLine
.
bounds
.
size
.
height
);
scannerLine
.
center
=
CGPointMake
(
self
.
bounds
.
size
.
width
*
0
.
5
,
0
);
[
self
addSubview
:
scannerLine
];
// 加载边框图像
for
(
NSInteger
i
=
1
;
i
<
5
;
i
++
)
{
NSString
*
imgName
=
[
NSString
stringWithFormat
:
@"ScanQR%zd"
,
i
];
UIImageView
*
img
=
[[
UIImageView
alloc
]
initWithImage
:[
self
imageWithName
:
imgName
bundle
:
imageBundle
]];
[
self
addSubview
:
img
];
CGFloat
offsetX
=
self
.
bounds
.
size
.
width
-
img
.
bounds
.
size
.
width
;
CGFloat
offsetY
=
self
.
bounds
.
size
.
height
-
img
.
bounds
.
size
.
height
;
switch
(
i
)
{
case
2
:
img
.
frame
=
CGRectOffset
(
img
.
frame
,
offsetX
,
0
);
break
;
case
3
:
img
.
frame
=
CGRectOffset
(
img
.
frame
,
0
,
offsetY
);
break
;
case
4
:
img
.
frame
=
CGRectOffset
(
img
.
frame
,
offsetX
,
offsetY
);
break
;
default
:
break
;
}
}
}
-
(
UIImage
*
)
imageWithName
:
(
NSString
*
)
imageName
bundle
:
(
NSBundle
*
)
imageBundle
{
NSString
*
fileName
=
[
NSString
stringWithFormat
:
@"%@@2x"
,
imageName
];
NSString
*
path
=
[
imageBundle
pathForResource
:
fileName
ofType
:
@"png"
];
return
[[
UIImage
imageWithContentsOfFile
:
path
]
imageWithRenderingMode
:
UIImageRenderingModeAlwaysTemplate
];
}
@end
Lighting/Tools/QRCode/HMScannerController.h
deleted
100755 → 0
View file @
0889cec3
//
// HMScannerController.h
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/2.
// Copyright © 2016年 itheima. All rights reserved.
//
#import <UIKit/UIKit.h>
/*!
扫描控制器
作用:
* 提供一个导航控制器,扫描 `二维码 / 条形码`
* 能够生成指定 `字符串` + `avatar(可选)` 的二维码名片
* 能够识别相册图片中的二维码(iOS 64 位设备)
使用:
@code
NSString *cardName = @"天涯刀哥 - 傅红雪";
UIImage *avatar = [UIImage imageNamed:@"avatar"];
// 实例化控制器,并指定完成回调
HMScannerController *scanner = [HMScannerController scannerWithCardName:cardName avatar:avatar completion:^(NSString *stringValue) {
self.scanResultLabel.text = stringValue;
}];
// 设置导航标题样式
[scanner setTitleColor:[UIColor whiteColor] tintColor:[UIColor greenColor]];
// 展现扫描控制器
[self showDetailViewController:scanner sender:nil];
@endcode
*/
@interface
HMScannerController
:
UINavigationController
/// 使用 `名片字符串` 实例化扫描导航控制器
///
/// @param cardName 名片字符串
/// @param avatar 头像图像
/// @param completion 完成回调
///
/// @return 扫描导航控制器
+
(
instancetype
)
scannerWithCardName
:(
NSString
*
)
cardName
avatar
:(
UIImage
*
)
avatar
completion
:(
void
(
^
)(
NSString
*
stringValue
))
completion
;
/// 使用 名片字符串 / 头像 异步生成二维码图像,并且指定头像占二维码图像的比例
///
/// @param string 名片字符串
/// @param avatar 头像图像
/// @param scale 头像占二维码图像的比例
/// @param completion 完成回调
+
(
void
)
cardImageWithCardName
:(
NSString
*
)
cardName
avatar
:(
UIImage
*
)
avatar
scale
:(
CGFloat
)
scale
completion
:(
void
(
^
)(
UIImage
*
image
))
completion
;
/// 设置导航栏标题颜色和 tintColor
///
/// @param titleColor 标题颜色
/// @param tintColor tintColor
-
(
void
)
setTitleColor
:(
UIColor
*
)
titleColor
tintColor
:(
UIColor
*
)
tintColor
;
@end
Lighting/Tools/QRCode/HMScannerController.m
deleted
100755 → 0
View file @
0889cec3
//
// HMScannerController.m
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/2.
// Copyright © 2016年 itheima. All rights reserved.
//
#import "HMScannerController.h"
#import "HMScannerViewController.h"
#import "HMScanner.h"
@implementation
HMScannerController
+
(
void
)
cardImageWithCardName
:(
NSString
*
)
cardName
avatar
:(
UIImage
*
)
avatar
scale
:(
CGFloat
)
scale
completion
:(
void
(
^
)(
UIImage
*
))
completion
{
[
HMScanner
qrImageWithString
:
cardName
avatar
:
avatar
scale
:
scale
completion
:
completion
];
}
+
(
instancetype
)
scannerWithCardName
:(
NSString
*
)
cardName
avatar
:(
UIImage
*
)
avatar
completion
:(
void
(
^
)(
NSString
*
))
completion
{
NSAssert
(
completion
!=
nil
,
@"必须传入完成回调"
);
return
[[
self
alloc
]
initWithCardName
:
cardName
avatar
:
avatar
completion
:
completion
];
}
-
(
instancetype
)
initWithCardName
:(
NSString
*
)
cardName
avatar
:(
UIImage
*
)
avatar
completion
:(
void
(
^
)(
NSString
*
))
completion
{
self
=
[
super
init
];
if
(
self
)
{
HMScannerViewController
*
scanner
=
[[
HMScannerViewController
alloc
]
initWithCardName
:
cardName
avatar
:
avatar
completion
:
completion
];
[
self
setTitleColor
:[
UIColor
whiteColor
]
tintColor
:[
UIColor
greenColor
]];
[
self
pushViewController
:
scanner
animated
:
NO
];
}
return
self
;
}
-
(
void
)
setTitleColor
:(
UIColor
*
)
titleColor
tintColor
:(
UIColor
*
)
tintColor
{
[
self
.
navigationBar
setTitleTextAttributes
:@{
NSForegroundColorAttributeName
:
titleColor
}];
self
.
navigationBar
.
tintColor
=
tintColor
;
}
-
(
UIInterfaceOrientationMask
)
supportedInterfaceOrientations
{
return
UIInterfaceOrientationMaskPortrait
;
}
-
(
UIStatusBarStyle
)
preferredStatusBarStyle
{
return
UIStatusBarStyleLightContent
;
}
@end
Lighting/Tools/QRCode/HMScannerMaskView.h
deleted
100755 → 0
View file @
0889cec3
//
// HMScannerMaskView.h
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/3.
// Copyright © 2016年 itheima. All rights reserved.
//
#import <UIKit/UIKit.h>
/// 扫描遮罩视图
@interface
HMScannerMaskView
:
UIView
/// 使用裁切区域实例化遮罩视图
///
/// @param frame 视图区域
/// @param cropRect 裁切区域
///
/// @return 遮罩视图
+
(
instancetype
)
maskViewWithFrame
:(
CGRect
)
frame
cropRect
:(
CGRect
)
cropRect
;
/// 裁切区域
@property
(
nonatomic
)
CGRect
cropRect
;
@end
Lighting/Tools/QRCode/HMScannerMaskView.m
deleted
100755 → 0
View file @
0889cec3
//
// HMScannerMaskView.m
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/3.
// Copyright © 2016年 itheima. All rights reserved.
//
#import "HMScannerMaskView.h"
@implementation
HMScannerMaskView
+
(
instancetype
)
maskViewWithFrame
:(
CGRect
)
frame
cropRect
:(
CGRect
)
cropRect
{
HMScannerMaskView
*
maskView
=
[[
self
alloc
]
initWithFrame
:
frame
];
maskView
.
backgroundColor
=
[
UIColor
clearColor
];
maskView
.
cropRect
=
cropRect
;
return
maskView
;
}
-
(
void
)
setCropRect
:(
CGRect
)
cropRect
{
_cropRect
=
cropRect
;
[
self
setNeedsDisplay
];
}
-
(
void
)
drawRect
:(
CGRect
)
rect
{
CGContextRef
ctx
=
UIGraphicsGetCurrentContext
();
[[
UIColor
colorWithWhite
:
0
.
0
alpha
:
0
.
4
]
setFill
];
CGContextFillRect
(
ctx
,
rect
);
CGContextClearRect
(
ctx
,
self
.
cropRect
);
[[
UIColor
colorWithWhite
:
0
.
95
alpha
:
1
.
0
]
setStroke
];
CGContextStrokeRectWithWidth
(
ctx
,
CGRectInset
(
_cropRect
,
1
,
1
),
1
);
}
@end
Lighting/Tools/QRCode/HMScannerViewController.h
deleted
100755 → 0
View file @
0889cec3
//
// HMScannerViewController.h
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/2.
// Copyright © 2016年 itheima. All rights reserved.
//
#import <UIKit/UIKit.h>
/// 扫描控制器
@interface
HMScannerViewController
:
UIViewController
/// 实例化扫描控制器
///
/// @param cardName 名片字符串
/// @param avatar 头像图片
/// @param completion 完成回调
///
/// @return 扫描控制器
-
(
instancetype
)
initWithCardName
:(
NSString
*
)
cardName
avatar
:(
UIImage
*
)
avatar
completion
:(
void
(
^
)(
NSString
*
stringValue
))
completion
;
@end
Lighting/Tools/QRCode/HMScannerViewController.m
deleted
100755 → 0
View file @
0889cec3
//
// HMScannerViewController.m
// HMQRCodeScanner
//
// Created by 刘凡 on 16/1/2.
// Copyright © 2016年 itheima. All rights reserved.
//
#import "HMScannerViewController.h"
#import "HMScanerCardViewController.h"
#import "HMScannerBorder.h"
#import "HMScannerMaskView.h"
#import "HMScanner.h"
/// 控件间距
#define kControlMargin 32.0
@interface
HMScannerViewController
()
<
UIImagePickerControllerDelegate
,
UINavigationControllerDelegate
>
/// 名片字符串
@property
(
nonatomic
)
NSString
*
cardName
;
/// 头像图片
@property
(
nonatomic
)
UIImage
*
avatar
;
/// 完成回调
@property
(
nonatomic
,
copy
)
void
(
^
completionCallBack
)(
NSString
*
);
@end
@implementation
HMScannerViewController
{
/// 扫描框
HMScannerBorder
*
scannerBorder
;
/// 扫描器
HMScanner
*
scanner
;
/// 提示标签
UILabel
*
tipLabel
;
}
-
(
instancetype
)
initWithCardName
:
(
NSString
*
)
cardName
avatar
:
(
UIImage
*
)
avatar
completion
:
(
void
(
^
)(
NSString
*
))
completion
{
self
=
[
super
init
];
if
(
self
)
{
self
.
cardName
=
cardName
;
self
.
avatar
=
avatar
;
self
.
completionCallBack
=
completion
;
}
return
self
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
prepareUI
];
// 实例化扫描器
__weak
typeof
(
self
)
weakSelf
=
self
;
scanner
=
[
HMScanner
scanerWithView
:
self
.
view
scanFrame
:
scannerBorder
.
frame
completion
:^
(
NSString
*
stringValue
)
{
// 完成回调
weakSelf
.
completionCallBack
(
stringValue
);
// 关闭
[
weakSelf
clickCloseButton
];
}];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
scannerBorder
startScannerAnimating
];
[
scanner
startScan
];
}
-
(
void
)
viewWillDisappear
:
(
BOOL
)
animated
{
[
super
viewWillDisappear
:
animated
];
[
scannerBorder
stopScannerAnimating
];
[
scanner
stopScan
];
}
#pragma mark - 监听方法
/// 点击关闭按钮
-
(
void
)
clickCloseButton
{
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
/// 点击相册按钮
-
(
void
)
clickAlbumButton
{
if
(
!
[
UIImagePickerController
isSourceTypeAvailable
:
UIImagePickerControllerSourceTypePhotoLibrary
])
{
tipLabel
.
text
=
@"无法访问相册"
;
return
;
}
UIImagePickerController
*
picker
=
[[
UIImagePickerController
alloc
]
init
];
picker
.
view
.
backgroundColor
=
[
UIColor
whiteColor
];
picker
.
delegate
=
self
;
[
self
showDetailViewController
:
picker
sender
:
nil
];
}
/// 点击名片按钮
-
(
void
)
clickCardButton
{
HMScanerCardViewController
*
vc
=
[[
HMScanerCardViewController
alloc
]
initWithCardName
:
self
.
cardName
avatar
:
self
.
avatar
];
[
self
showViewController
:
vc
sender
:
nil
];
}
#pragma mark - UIImagePickerControllerDelegate
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
<
NSString
*
,
id
>
*
)
info
{
// 扫描图像
[
HMScanner
scaneImage
:
info
[
UIImagePickerControllerOriginalImage
]
completion
:
^
(
NSArray
*
values
)
{
if
(
values
.
count
>
0
)
{
self
.
completionCallBack
(
values
.
firstObject
);
[
self
dismissViewControllerAnimated
:
NO
completion
:
^
{
[
self
clickCloseButton
];
}];
}
else
{
tipLabel
.
text
=
@"没有识别到二维码,请选择其他照片"
;
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
}];
}
#pragma mark - 设置界面
-
(
void
)
prepareUI
{
self
.
view
.
backgroundColor
=
[
UIColor
darkGrayColor
];
[
self
prepareNavigationBar
];
[
self
prepareScanerBorder
];
[
self
prepareOtherControls
];
}
/// 准备提示标签和名片按钮
-
(
void
)
prepareOtherControls
{
// 1> 提示标签
tipLabel
=
[[
UILabel
alloc
]
init
];
tipLabel
.
text
=
@"将二维码/条码放入框中,即可自动扫描"
;
tipLabel
.
font
=
[
UIFont
systemFontOfSize
:
12
];
tipLabel
.
textColor
=
[
UIColor
whiteColor
];
tipLabel
.
textAlignment
=
NSTextAlignmentCenter
;
[
tipLabel
sizeToFit
];
tipLabel
.
center
=
CGPointMake
(
scannerBorder
.
center
.
x
,
CGRectGetMaxY
(
scannerBorder
.
frame
)
+
kControlMargin
);
[
self
.
view
addSubview
:
tipLabel
];
// 2> 名片按钮
UIButton
*
cardButton
=
[[
UIButton
alloc
]
init
];
[
cardButton
setTitle
:
@"我的名片"
forState
:
UIControlStateNormal
];
cardButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
];
[
cardButton
setTitleColor
:
self
.
navigationController
.
navigationBar
.
tintColor
forState
:
UIControlStateNormal
];
[
cardButton
sizeToFit
];
cardButton
.
center
=
CGPointMake
(
tipLabel
.
center
.
x
,
CGRectGetMaxY
(
tipLabel
.
frame
)
+
kControlMargin
);
[
self
.
view
addSubview
:
cardButton
];
[
cardButton
addTarget
:
self
action
:
@selector
(
clickCardButton
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
/// 准备扫描框
-
(
void
)
prepareScanerBorder
{
CGFloat
width
=
self
.
view
.
bounds
.
size
.
width
-
80
;
scannerBorder
=
[[
HMScannerBorder
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
width
,
width
)];
scannerBorder
.
center
=
self
.
view
.
center
;
scannerBorder
.
tintColor
=
self
.
navigationController
.
navigationBar
.
tintColor
;
[
self
.
view
addSubview
:
scannerBorder
];
HMScannerMaskView
*
maskView
=
[
HMScannerMaskView
maskViewWithFrame
:
self
.
view
.
bounds
cropRect
:
scannerBorder
.
frame
];
[
self
.
view
insertSubview
:
maskView
atIndex
:
0
];
}
/// 准备导航栏
-
(
void
)
prepareNavigationBar
{
// 1> 背景颜色
[
self
.
navigationController
.
navigationBar
setBarTintColor
:[
UIColor
colorWithWhite
:
0
.
1
alpha
:
1
.
0
]];
self
.
navigationController
.
navigationBar
.
translucent
=
YES
;
self
.
navigationController
.
navigationBar
.
shadowImage
=
[[
UIImage
alloc
]
init
];
// 2> 标题
self
.
title
=
@"扫一扫"
;
// 3> 左右按钮
self
.
navigationItem
.
leftBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"关闭"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
clickCloseButton
)];
self
.
navigationItem
.
rightBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"相册"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
clickAlbumButton
)];
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment