Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
dz_TZImagePickerController
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuijing
dz_TZImagePickerController
Commits
aaf721b6
Commit
aaf721b6
authored
Mar 06, 2018
by
yuzheng.tz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
升级TZLocationManager,实现新的定位成功代理方法
parent
9da85019
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
TZImagePickerController/TZImagePickerController/TZLocationManager.h
...kerController/TZImagePickerController/TZLocationManager.h
+2
-2
TZImagePickerController/TZImagePickerController/TZLocationManager.m
...kerController/TZImagePickerController/TZLocationManager.m
+7
-7
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+2
-2
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+2
-2
No files found.
TZImagePickerController/TZImagePickerController/TZLocationManager.h
View file @
aaf721b6
...
...
@@ -16,9 +16,9 @@
/// 开始定位
-
(
void
)
startLocation
;
-
(
void
)
startLocationWithSuccessBlock
:(
void
(
^
)(
CLLocation
*
location
,
CLLocation
*
oldLocation
))
successBlock
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failureBlock
;
-
(
void
)
startLocationWithSuccessBlock
:(
void
(
^
)(
NSArray
<
CLLocation
*>
*
))
successBlock
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failureBlock
;
-
(
void
)
startLocationWithGeocoderBlock
:(
void
(
^
)(
NSArray
*
geocoderArray
))
geocoderBlock
;
-
(
void
)
startLocationWithSuccessBlock
:(
void
(
^
)(
CLLocation
*
location
,
CLLocation
*
oldLocation
))
successBlock
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failureBlock
geocoderBlock
:(
void
(
^
)(
NSArray
*
geocoderArray
))
geocoderBlock
;
-
(
void
)
startLocationWithSuccessBlock
:(
void
(
^
)(
NSArray
<
CLLocation
*>
*
))
successBlock
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failureBlock
geocoderBlock
:(
void
(
^
)(
NSArray
*
geocoderArray
))
geocoderBlock
;
@end
TZImagePickerController/TZImagePickerController/TZLocationManager.m
View file @
aaf721b6
...
...
@@ -12,7 +12,7 @@
@interface
TZLocationManager
()
<
CLLocationManagerDelegate
>
@property
(
nonatomic
,
strong
)
CLLocationManager
*
locationManager
;
/// 定位成功的回调block
@property
(
nonatomic
,
copy
)
void
(
^
successBlock
)(
CLLocation
*
location
,
CLLocation
*
oldLocation
);
@property
(
nonatomic
,
copy
)
void
(
^
successBlock
)(
NSArray
<
CLLocation
*>
*
);
/// 编码成功的回调block
@property
(
nonatomic
,
copy
)
void
(
^
geocodeBlock
)(
NSArray
*
geocodeArray
);
/// 定位失败的回调block
...
...
@@ -39,7 +39,7 @@
[
self
startLocationWithSuccessBlock
:
nil
failureBlock
:
nil
geocoderBlock
:
nil
];
}
-
(
void
)
startLocationWithSuccessBlock
:(
void
(
^
)(
CLLocation
*
location
,
CLLocation
*
oldLocation
))
successBlock
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failureBlock
{
-
(
void
)
startLocationWithSuccessBlock
:(
void
(
^
)(
NSArray
<
CLLocation
*>
*
))
successBlock
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failureBlock
{
[
self
startLocationWithSuccessBlock
:
successBlock
failureBlock
:
failureBlock
geocoderBlock
:
nil
];
}
...
...
@@ -47,7 +47,7 @@
[
self
startLocationWithSuccessBlock
:
nil
failureBlock
:
nil
geocoderBlock
:
geocoderBlock
];
}
-
(
void
)
startLocationWithSuccessBlock
:(
void
(
^
)(
CLLocation
*
location
,
CLLocation
*
oldLocation
))
successBlock
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failureBlock
geocoderBlock
:(
void
(
^
)(
NSArray
*
geocoderArray
))
geocoderBlock
{
-
(
void
)
startLocationWithSuccessBlock
:(
void
(
^
)(
NSArray
<
CLLocation
*>
*
))
successBlock
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failureBlock
geocoderBlock
:(
void
(
^
)(
NSArray
*
geocoderArray
))
geocoderBlock
{
[
self
.
locationManager
startUpdatingLocation
];
_successBlock
=
successBlock
;
_geocodeBlock
=
geocoderBlock
;
...
...
@@ -57,16 +57,16 @@
#pragma mark - CLLocationManagerDelegate
/// 地理位置发生改变时触发
-
(
void
)
locationManager
:(
CLLocationManager
*
)
manager
didUpdate
ToLocation
:(
CLLocation
*
)
newLocation
fromLocation
:(
CLLocation
*
)
oldLocation
{
-
(
void
)
locationManager
:(
CLLocationManager
*
)
manager
didUpdate
Locations
:(
NSArray
<
CLLocation
*>
*
)
locations
{
[
manager
stopUpdatingLocation
];
if
(
_successBlock
)
{
_successBlock
(
newLocation
,
oldLocation
);
_successBlock
(
locations
);
}
if
(
_geocodeBlock
)
{
if
(
_geocodeBlock
&&
locations
.
count
)
{
CLGeocoder
*
geocoder
=
[[
CLGeocoder
alloc
]
init
];
[
geocoder
reverseGeocodeLocation
:
newLocation
completionHandler
:
^
(
NSArray
*
array
,
NSError
*
error
)
{
[
geocoder
reverseGeocodeLocation
:
[
locations
firstObject
]
completionHandler
:
^
(
NSArray
*
array
,
NSError
*
error
)
{
_geocodeBlock
(
array
);
}];
}
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
aaf721b6
...
...
@@ -585,9 +585,9 @@ static CGFloat itemMargin = 5;
-
(
void
)
pushImagePickerController
{
// 提前定位
__weak
typeof
(
self
)
weakSelf
=
self
;
[[
TZLocationManager
manager
]
startLocationWithSuccessBlock
:
^
(
CLLocation
*
location
,
CLLocation
*
oldLocation
)
{
[[
TZLocationManager
manager
]
startLocationWithSuccessBlock
:
^
(
NSArray
<
CLLocation
*>
*
locations
)
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
strongSelf
.
location
=
location
;
strongSelf
.
location
=
[
locations
firstObject
]
;
}
failureBlock
:
^
(
NSError
*
error
)
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
strongSelf
.
location
=
nil
;
...
...
TZImagePickerController/ViewController.m
View file @
aaf721b6
...
...
@@ -370,9 +370,9 @@
-
(
void
)
pushImagePickerController
{
// 提前定位
__weak
typeof
(
self
)
weakSelf
=
self
;
[[
TZLocationManager
manager
]
startLocationWithSuccessBlock
:
^
(
CLLocation
*
location
,
CLLocation
*
oldLocation
)
{
[[
TZLocationManager
manager
]
startLocationWithSuccessBlock
:
^
(
NSArray
<
CLLocation
*>
*
locations
)
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
strongSelf
.
location
=
location
;
strongSelf
.
location
=
[
locations
firstObject
]
;
}
failureBlock
:
^
(
NSError
*
error
)
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
strongSelf
.
location
=
nil
;
...
...
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