Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
ZhiJi-Overseas
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmj
ZhiJi-Overseas
Commits
3802d2db
Commit
3802d2db
authored
Jul 31, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
93f52b23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
24 deletions
+49
-24
.DS_Store
.DS_Store
+0
-0
ZJLocationRemindSelectController.m
...sses/LocationAttention/ZJLocationRemindSelectController.m
+49
-24
No files found.
.DS_Store
View file @
3802d2db
No preview for this file type
ZhiJi/Classes/LocationAttention/ZJLocationRemindSelectController.m
View file @
3802d2db
...
...
@@ -14,7 +14,7 @@
#import "ZJCustomAnnotation.h"
#import "ZJMapPinchGestureRecognizer.h"
@interface
ZJLocationRemindSelectController
()
<
SJSliderDelegate
,
MKMapViewDelegate
,
UIGestureRecognizerDelegate
>
{
@interface
ZJLocationRemindSelectController
()
<
CLLocationManagerDelegate
,
SJSliderDelegate
,
MKMapViewDelegate
,
UIGestureRecognizerDelegate
>
{
BOOL
sliderDrag
;
}
...
...
@@ -47,9 +47,6 @@
[
super
viewDidLoad
];
[
self
setupMapViewAndUI
];
// [self setUpSearchApi];
[
self
getCurrentLocation
];
}
...
...
@@ -83,10 +80,7 @@
///把地图添加至view
[
self
.
view
addSubview
:
_mapView
];
[
self
.
view
sendSubviewToBack
:
_mapView
];
self
.
circle
=
[
MKCircle
circleWithCenterCoordinate
:
self
.
mapView
.
userLocation
.
location
.
coordinate
radius
:
_radius
];
[
self
.
mapView
addOverlay
:
self
.
circle
];
SJSlider
*
slider
=
({
SJSlider
*
slider
=
[
SJSlider
new
];
[
self
.
view
addSubview
:
slider
];
...
...
@@ -111,10 +105,7 @@
self
.
remarkString
=
_editModel
.
remark
;
self
.
addressMainTitleLabel
.
text
=
_editModel
.
address
;
self
.
addressSubTitleLabel
.
text
=
_editModel
.
addressName
;
CLLocationCoordinate2D
centerLocationCoordinate
=
[
self
.
mapView
convertPoint
:
self
.
mapView
.
center
toCoordinateFromView
:
self
.
mapView
];
[
self
.
mapView
setRegion
:
MKCoordinateRegionMakeWithDistance
(
self
.
mapView
.
userLocation
.
location
.
coordinate
,
_radius
*
3
,
_radius
*
3
)
animated
:
false
];
// [self.mapView addGestureRecognizer:[[ZJMapPinchGestureRecognizer alloc] initWithMapView:self.mapView]];
//
// UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didRecognizePan)];
...
...
@@ -131,18 +122,18 @@
}
-
(
void
)
mapView
:
(
MKMapView
*
)
mapView
regionDidChangeAnimated
:
(
BOOL
)
animated
{
//
[self.mapView removeAnnotations:self.mapView.annotations];
//
[self.mapView removeOverlays:self.mapView.overlays];
//
//
_centerAnnotation = [[ZJCustomAnnotation alloc] init];
//
_centerAnnotation.coordinate = self.mapView.centerCoordinate;
//
[self.mapView addAnnotation:_centerAnnotation];
//
//
self.circle = [MKCircle circleWithCenterCoordinate:self.mapView.centerCoordinate radius:_radius];
//
[self.mapView addOverlay:self.circle];
//
//
self.location = [[CLLocation alloc] initWithLatitude:mapView.centerCoordinate.latitude longitude:mapView.centerCoordinate.longitude];
//
[self centerLocation:self.location];
[
self
.
mapView
removeAnnotations
:
self
.
mapView
.
annotations
];
[
self
.
mapView
removeOverlays
:
self
.
mapView
.
overlays
];
_centerAnnotation
=
[[
ZJCustomAnnotation
alloc
]
init
];
_centerAnnotation
.
coordinate
=
self
.
mapView
.
centerCoordinate
;
[
self
.
mapView
addAnnotation
:
_centerAnnotation
];
self
.
circle
=
[
MKCircle
circleWithCenterCoordinate
:
self
.
mapView
.
centerCoordinate
radius
:
_radius
];
[
self
.
mapView
addOverlay
:
self
.
circle
];
self
.
location
=
[[
CLLocation
alloc
]
initWithLatitude
:
mapView
.
centerCoordinate
.
latitude
longitude
:
mapView
.
centerCoordinate
.
longitude
];
[
self
centerLocation
:
self
.
location
];
}
-
(
void
)
centerLocation
:
(
CLLocation
*
)
location
{
...
...
@@ -174,6 +165,40 @@
}];
}
-
(
void
)
getCurrentLocation
{
if
(
_editModel
)
{
CLLocationCoordinate2D
centerLocationCoordinate
=
CLLocationCoordinate2DMake
(
_editModel
.
lat
,
_editModel
.
lon
);
[
self
.
mapView
setRegion
:
MKCoordinateRegionMakeWithDistance
(
centerLocationCoordinate
,
_radius
*
3
,
_radius
*
3
)
animated
:
false
];
}
else
{
self
.
locationManager
=
[[
CLLocationManager
alloc
]
init
];
// 带逆地理信息的一次定位(返回坐标和地址信息)
[
self
.
locationManager
setDesiredAccuracy
:
kCLLocationAccuracyHundredMeters
];
self
.
locationManager
.
delegate
=
self
;
self
.
locationManager
.
distanceFilter
=
200
;
self
.
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyBest
;
[
self
.
locationManager
startUpdatingLocation
];
}
}
-
(
void
)
locationManager
:
(
CLLocationManager
*
)
manager
didUpdateLocations
:
(
NSArray
<
CLLocation
*>
*
)
locations
API_AVAILABLE
(
ios
(
6
.
0
),
macos
(
10
.
9
)){
if
([
locations
firstObject
])
{
[
self
centerLocation
:[
locations
firstObject
]];
self
.
circle
=
[
MKCircle
circleWithCenterCoordinate
:[
locations
firstObject
].
coordinate
radius
:
_radius
];
[
self
.
mapView
addOverlay
:
self
.
circle
];
[
self
.
mapView
setRegion
:
MKCoordinateRegionMakeWithDistance
(
[
locations
firstObject
].
coordinate
,
_radius
*
3
,
_radius
*
3
)
animated
:
false
];
[
manager
stopUpdatingLocation
];
}
}
-
(
IBAction
)
searchAction
:
(
UIButton
*
)
sender
{
...
...
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