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
93f52b23
Commit
93f52b23
authored
Jul 31, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
e5bd67ef
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
214 deletions
+76
-214
.DS_Store
.DS_Store
+0
-0
project.pbxproj
ZhiJi.xcodeproj/project.pbxproj
+6
-0
Location.storyboard
.../Classes/LocationAttention/Base.lproj/Location.storyboard
+2
-2
ZJLocationRemindSelectController.m
...sses/LocationAttention/ZJLocationRemindSelectController.m
+60
-211
ZJMapPinchGestureRecognizer.m
ZhiJi/Classes/Map/Controller/ZJMapPinchGestureRecognizer.m
+1
-1
ResourceHeader.pch
ZhiJi/Classes/Tools/PCH/ResourceHeader.pch
+7
-0
No files found.
.DS_Store
View file @
93f52b23
No preview for this file type
ZhiJi.xcodeproj/project.pbxproj
View file @
93f52b23
...
...
@@ -55,6 +55,7 @@
A948C4DF249A27FE00C22D69
/* ZJOauthLoginConfig.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A948C4DE249A27FE00C22D69
/* ZJOauthLoginConfig.m */
;
};
A948C504249B887B00C22D69
/* ZJGoodsModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A948C503249B887B00C22D69
/* ZJGoodsModel.m */
;
};
A94EE53324D401EB0046038D
/* ZJCustomAnnotation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94EE53124D401EB0046038D
/* ZJCustomAnnotation.m */
;
};
A94EE53624D404400046038D
/* ZJMapPinchGestureRecognizer.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94EE53424D404400046038D
/* ZJMapPinchGestureRecognizer.m */
;
};
A95590932490AE3C00F3BB41
/* QJGIFView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A955908D2490AE3C00F3BB41
/* QJGIFView.m */
;
};
A95590942490AE3C00F3BB41
/* MBProgressHUD+MJ.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A955908E2490AE3C00F3BB41
/* MBProgressHUD+MJ.m */
;
};
A95590952490AE3C00F3BB41
/* MBProgressHUD.bundle in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A95590902490AE3C00F3BB41
/* MBProgressHUD.bundle */
;
};
...
...
@@ -284,6 +285,8 @@
A948C503249B887B00C22D69
/* ZJGoodsModel.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ZJGoodsModel.m
;
sourceTree
=
"<group>"
;
};
A94EE53124D401EB0046038D
/* ZJCustomAnnotation.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ZJCustomAnnotation.m
;
sourceTree
=
"<group>"
;
};
A94EE53224D401EB0046038D
/* ZJCustomAnnotation.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ZJCustomAnnotation.h
;
sourceTree
=
"<group>"
;
};
A94EE53424D404400046038D
/* ZJMapPinchGestureRecognizer.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ZJMapPinchGestureRecognizer.m
;
sourceTree
=
"<group>"
;
};
A94EE53524D404400046038D
/* ZJMapPinchGestureRecognizer.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ZJMapPinchGestureRecognizer.h
;
sourceTree
=
"<group>"
;
};
A955908B2490AE3C00F3BB41
/* MBProgressHUD+MJ.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"MBProgressHUD+MJ.h"
;
sourceTree
=
"<group>"
;
};
A955908D2490AE3C00F3BB41
/* QJGIFView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
QJGIFView.m
;
sourceTree
=
"<group>"
;
};
A955908E2490AE3C00F3BB41
/* MBProgressHUD+MJ.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"MBProgressHUD+MJ.m"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1086,6 +1089,8 @@
64F52441248F34DB0032BCA2
/* ZJFriendTrackMapViewController.m */
,
A94EE53224D401EB0046038D
/* ZJCustomAnnotation.h */
,
A94EE53124D401EB0046038D
/* ZJCustomAnnotation.m */
,
A94EE53524D404400046038D
/* ZJMapPinchGestureRecognizer.h */
,
A94EE53424D404400046038D
/* ZJMapPinchGestureRecognizer.m */
,
);
path
=
Controller
;
sourceTree
=
"<group>"
;
...
...
@@ -1562,6 +1567,7 @@
D5271ED324907E6100F8B107
/* ZJLocationAttentionFooter.swift in Sources */
,
A95F5C98248DDE81001DB97E
/* ZJPhoneLoginViewController.m in Sources */
,
645401AB248F94DF003591FB
/* ZJMineUserInfoModel.m in Sources */
,
A94EE53624D404400046038D
/* ZJMapPinchGestureRecognizer.m in Sources */
,
A95F5C5F248DDE81001DB97E
/* UIColor+HExtension.m in Sources */
,
A948C4CA2497122B00C22D69
/* ZJMapCardFriendSelectView.m in Sources */
,
D5322699249092CF00A4963B
/* ZJZMFAPIFactory.m in Sources */
,
...
...
ZhiJi/Classes/LocationAttention/Base.lproj/Location.storyboard
View file @
93f52b23
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"16097"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"16097
.2
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina4_7"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<deployment
identifier=
"iOS"
/>
...
...
@@ -191,7 +191,7 @@
<constraint
firstAttribute=
"trailing"
secondItem=
"ld4-5g-zWj"
secondAttribute=
"trailing"
id=
"wFa-n9-VDJ"
/>
</constraints>
</view>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"f1F-Oj-HgK"
>
<view
hidden=
"YES"
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"f1F-Oj-HgK"
>
<rect
key=
"frame"
x=
"10"
y=
"10"
width=
"355"
height=
"62"
/>
<subviews>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"location_find_radus_img_bg"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"T43-hs-epE"
>
...
...
ZhiJi/Classes/LocationAttention/ZJLocationRemindSelectController.m
View file @
93f52b23
...
...
@@ -7,46 +7,38 @@
//
#import "ZJLocationRemindSelectController.h"
#import <MAMapKit/MAMapKit.h>
#import "ZJLocationFindSearchViewController.h"
#import "SJSlider.h"
// 逆地理编码
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapSearchKit/AMapSearchKit.h>
#import <AMapLocationKit/AMapLocationKit.h>
#import <CoreLocation/CoreLocation.h>
#import "ZJUserInfoManager.h"
#import <MapKit/MapKit.h>
#import "ZJCustomAnnotation.h"
#import "ZJMapPinchGestureRecognizer.h"
@interface
ZJLocationRemindSelectController
()
<
MAMapViewDelegate
,
SJSliderDelegate
,
AMapSearchDelegate
,
MKMapView
Delegate
>
{
@interface
ZJLocationRemindSelectController
()
<
SJSliderDelegate
,
MKMapViewDelegate
,
UIGestureRecognizer
Delegate
>
{
BOOL
sliderDrag
;
}
@property
(
nonatomic
,
strong
)
MKMapView
*
mapView
;
@property
(
nonatomic
,
strong
)
CLLocationManager
*
locationManager
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIView
*
sliderContainerView
;
@property
(
weak
,
nonatomic
)
IBOutlet
UILabel
*
addressMainTitleLabel
;
@property
(
weak
,
nonatomic
)
IBOutlet
UILabel
*
addressSubTitleLabel
;
@property
(
weak
,
nonatomic
)
IBOutlet
UILabel
*
distanceTipLabel
;
@property
(
nonatomic
,
strong
)
MAPointAnnotation
*
pointAnnotation
;
//@property (nonatomic, strong) AMapSearchAPI *searchApi;
/// 反编码
//@property (nonatomic, strong) AMapReGeocodeSearchRequest *searchRequest;
///地址组成要素
//@property (nonatomic, strong) AMapAddressComponent *addressComponent;
/// 备注
@property
(
nonatomic
,
strong
)
NSString
*
remarkString
;
@property
(
nonatomic
,
strong
)
AMapLocationManager
*
locationManager
;
@property
(
nonatomic
,
strong
)
MKCircle
*
circle
;
@property
(
nonatomic
,
strong
)
SJSlider
*
slider
;
@property
(
nonatomic
,
assign
)
float
radius
;
@property
(
nonatomic
,
strong
)
CLLocation
*
location
;
@property
(
nonatomic
,
strong
)
ZJCustomAnnotation
*
centerAnnotation
;
@end
@implementation
ZJLocationRemindSelectController
...
...
@@ -61,11 +53,6 @@
[
self
getCurrentLocation
];
}
//- (void) setUpSearchApi {
// self.searchApi = [[AMapSearchAPI alloc] init];
// self.searchApi.delegate = self;
//}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
self
.
navigationController
setNavigationBarHidden
:
false
animated
:
true
];
...
...
@@ -74,35 +61,31 @@
-
(
void
)
viewDidAppear
:
(
BOOL
)
animated
{
[
super
viewDidAppear
:
animated
];
[
self
.
mapView
addAnnotation
:
self
.
pointAnnotation
];
self
.
slider
.
value
=
0
.
375
;
[
self
sliderDidEndDragging
:
self
.
slider
];
}
-
(
void
)
setupMapViewAndUI
{
_radius
=
500
;
if
(
_editModel
)
{
_radius
=
_editModel
.
radius
;
}
else
{
_radius
=
500
;
}
///初始化地图
self
.
mapView
=
[[
MKMapView
alloc
]
initWithFrame
:
self
.
view
.
bounds
];
// if ([ZJUserInfoManager CNLanguage]) {
// self.mapView.mapLanguage = @0;
// }else{
// self.mapView.mapLanguage = @1;
// }
_mapView
.
autoresizingMask
=
UIViewAutoresizingFlexibleWidth
|
UIViewAutoresizingFlexibleHeight
;
///把地图添加至view
[
self
.
view
addSubview
:
_mapView
];
[
self
.
view
sendSubviewToBack
:
_mapView
];
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
_mapView
.
showsUserLocation
=
false
;
_mapView
.
delegate
=
self
;
_mapView
.
showsScale
=
false
;
_mapView
.
showsCompass
=
false
;
// _mapView.zoomLevel = 15.5;
// _mapView.customizeUserLocationAccuracyCircleRepresentation = true;
self
.
circle
=
[
MKCircle
circleWithCenterCoordinate
:
self
.
mapView
.
centerCoordinate
radius
:
500
];
[
self
.
mapView
addOverlay
:
self
.
circle
];
///把地图添加至view
[
self
.
view
addSubview
:
_mapView
];
[
self
.
view
sendSubviewToBack
:
_mapView
];
[
AMapServices
sharedServices
].
apiKey
=
@"501f8a894329f4b57bbfee208a11676f"
;
self
.
circle
=
[
MKCircle
circleWithCenterCoordinate
:
self
.
mapView
.
userLocation
.
location
.
coordinate
radius
:
_radius
];
[
self
.
mapView
addOverlay
:
self
.
circle
];
SJSlider
*
slider
=
({
SJSlider
*
slider
=
[
SJSlider
new
];
...
...
@@ -123,47 +106,43 @@
[
slider
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
edges
.
equalTo
(
self
.
sliderContainerView
);
}];
// self.distanceTipLabel.text = [NSString stringWithFormat:@"%0.fm", self.mapView.metersPerPointForCurrentZoom * 20 + 200.0];
if
(
_editModel
)
{
self
.
distanceTipLabel
.
text
=
[
NSString
stringWithFormat
:
@"%0dm"
,
_editModel
.
radius
];
}
self
.
distanceTipLabel
.
text
=
[
NSString
stringWithFormat
:
@"%0fm"
,
_radius
];
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
(
centerLocationCoordinate
,
10000
,
10000
)
animated
:
false
];
[
self
.
mapView
setRegion
:
MKCoordinateRegionMakeWithDistance
(
self
.
mapView
.
userLocation
.
location
.
coordinate
,
_radius
*
3
,
_radius
*
3
)
animated
:
false
];
[
self
.
mapView
addGestureRecognizer
:[[
ZJMapPinchGestureRecognizer
alloc
]
initWithMapView
:
self
.
mapView
]];
// [self.mapView addGestureRecognizer:[[ZJMapPinchGestureRecognizer alloc] initWithMapView:self.mapView]];
//
// UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didRecognizePan)];
// pan.delegate = self;
// [self.mapView addGestureRecognizer:pan];
}
//- (void)didRecognizePan{
//
//}
-
(
void
)
mapView
:
(
MKMapView
*
)
mapView
regionWillChangeAnimated
:
(
BOOL
)
animated
{
}
-
(
void
)
mapView
:
(
MKMapView
*
)
mapView
regionDidChangeAnimated
:
(
BOOL
)
animated
{
[
self
.
mapView
removeAnnotations
:
self
.
mapView
.
annotations
];
[
self
.
mapView
removeOverlays
:
self
.
mapView
.
overlays
];
ZJCustomAnnotation
*
annotation
=
[[
ZJCustomAnnotation
alloc
]
init
];
annotation
.
coordinate
=
self
.
mapView
.
centerCoordinate
;
annotation
.
title
=
@"北京"
;
annotation
.
subtitle
=
@"默认显示的为首都北京"
;
[
self
.
mapView
addAnnotation
:
annotation
];
self
.
circle
=
[
MKCircle
circleWithCenterCoordinate
:
self
.
mapView
.
centerCoordinate
radius
:
500
];
[
self
.
mapView
addOverlay
:
self
.
circle
];
// [self.mapView removeAnnotations:self.mapView.annotations];
// [self.mapView removeOverlays:self.mapView.overlays];
//
// CLLocationCoordinate2D center = mapView.region.center;
// //设置跨度为当前地图范围的跨度 * 比例系数
// MKCoordinateSpan span = MKCoordinateSpanMake(mapView.region.span.latitudeDelta * 2, mapView.region.span.longitudeDelta * 2);
// [mapView setRegion:MKCoordinateRegionMake(center, span) animated:NO];
self
.
location
=
[[
CLLocation
alloc
]
initWithLatitude
:
mapView
.
centerCoordinate
.
latitude
longitude
:
mapView
.
centerCoordinate
.
longitude
];
[
self
centerLocation
:
self
.
location
];
// _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
{
...
...
@@ -188,68 +167,16 @@
self
.
addressMainTitleLabel
.
text
=
placemark
.
name
;
self
.
addressSubTitleLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
placemark
.
subLocality
?:
@""
,
placemark
.
thoroughfare
?:
@""
,
placemark
.
subThoroughfare
?:
@""
];
}
}];
}
//添加固定
-
(
void
)
addPointAnnotation
:
(
CLLocationCoordinate2D
)
oordinate
{
self
.
pointAnnotation
=
[[
MAPointAnnotation
alloc
]
init
];
self
.
pointAnnotation
.
coordinate
=
CLLocationCoordinate2DMake
(
oordinate
.
latitude
,
oordinate
.
longitude
);
self
.
pointAnnotation
.
lockedToScreen
=
YES
;
self
.
pointAnnotation
.
lockedScreenPoint
=
self
.
mapView
.
center
;
}
//添加固定
-
(
void
)
getCurrentLocation
{
self
.
locationManager
=
[[
AMapLocationManager
alloc
]
init
];
// 带逆地理信息的一次定位(返回坐标和地址信息)
[
self
.
locationManager
setDesiredAccuracy
:
kCLLocationAccuracyHundredMeters
];
// 定位超时时间,最低2s,此处设置为2s
self
.
locationManager
.
locationTimeout
=
2
;
// 逆地理请求超时时间,最低2s,此处设置为2s
self
.
locationManager
.
reGeocodeTimeout
=
2
;
if
([
ZJUserInfoManager
CNLanguage
]){
self
.
locationManager
.
reGeocodeLanguage
=
AMapLocationReGeocodeLanguageChinse
;
}
else
{
self
.
locationManager
.
reGeocodeLanguage
=
AMapLocationReGeocodeLanguageEnglish
;
}
// 带逆地理(返回坐标和地址信息)。将下面代码中的 YES 改成 NO ,则不会返回地址信息。
__weak
typeof
(
self
)
_self
=
self
;
[
self
.
locationManager
requestLocationWithReGeocode
:
NO
completionBlock
:
^
(
CLLocation
*
location
,
AMapLocationReGeocode
*
regeocode
,
NSError
*
error
)
{
if
(
error
)
{
NSLog
(
@"locError:{%ld - %@};"
,
(
long
)
error
.
code
,
error
.
localizedDescription
);
if
(
error
.
code
==
AMapLocationErrorLocateFailed
)
{
return
;
}
}
NSLog
(
@"location:%@"
,
location
);
if
(
self
.
editModel
){
[
_self
addPointAnnotation
:
CLLocationCoordinate2DMake
(
self
.
editModel
.
lat
,
self
.
editModel
.
lon
)];
[
_self
.
mapView
setCenterCoordinate
:
CLLocationCoordinate2DMake
(
self
.
editModel
.
lat
,
self
.
editModel
.
lon
)
animated
:
false
];
}
else
{
[
_self
addPointAnnotation
:
location
.
coordinate
];
[
_self
.
mapView
setCenterCoordinate
:
location
.
coordinate
animated
:
false
];
self
.
centerAnnotation
.
title
=
placemark
.
name
;
self
.
centerAnnotation
.
subtitle
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
placemark
.
subLocality
?:
@""
,
placemark
.
thoroughfare
?:
@""
,
placemark
.
subThoroughfare
?:
@""
];
}
}];
}
-
(
IBAction
)
searchAction
:
(
UIButton
*
)
sender
{
ZJLocationFindSearchViewController
*
searchVC
=
[[
UIStoryboard
storyboardWithName
:
@"Location"
bundle
:
nil
]
instantiateViewControllerWithIdentifier
:
@"ZJLocationFindSearchViewController"
];
searchVC
.
selectAddressPoiClosure
=
^
(
AMapPOI
*
_Nonnull
poi
)
{
// self.searchRequest.location = [AMapGeoPoint locationWithLatitude:poi.location.latitude longitude:poi.location.longitude];
// [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(poi.location.latitude, poi.location.longitude) animated:false];
// self.searchRequest.requireExtension = YES;
// [self.searchApi AMapReGoecodeSearch: self.searchRequest];
self
.
location
=
[[
CLLocation
alloc
]
initWithLatitude
:
poi
.
location
.
latitude
longitude
:
poi
.
location
.
longitude
];
[
self
reverseGeocodeLocation
:
self
.
location
];
};
[
self
.
navigationController
pushViewController
:
searchVC
animated
:
true
];
}
-
(
IBAction
)
commitAction
:
(
UIButton
*
)
sender
{
...
...
@@ -274,20 +201,6 @@
[
self
.
navigationController
popViewControllerAnimated
:
true
];
}
-
(
IBAction
)
remakFieldEditingChanged
:
(
UITextField
*
)
sender
{
NSLog
(
@"%@"
,
sender
.
text
);
self
.
remarkString
=
sender
.
text
;
}
/**
* @brief 地图移动结束后调用此接口
* @param mapView 地图view
* @param wasUserAction 标识是否是用户动作
*/
-
(
void
)
mapView
:
(
MAMapView
*
)
mapView
mapDidMoveByUser
:
(
BOOL
)
wasUserAction
{
self
.
location
=
[[
CLLocation
alloc
]
initWithLatitude
:
mapView
.
centerCoordinate
.
latitude
longitude
:
mapView
.
centerCoordinate
.
longitude
];
[
self
reverseGeocodeLocation
:
self
.
location
];
}
/// Description
/// @param mapView mapView description
...
...
@@ -295,64 +208,6 @@
// [self.circle setCoordinate:mapView.centerCoordinate];
}
-
(
void
)
reverseGeocodeLocation
:
(
CLLocation
*
)
location
{
// 获取当前所在的城市名
CLGeocoder
*
geocoder
=
[[
CLGeocoder
alloc
]
init
];
CLLocation
*
newLocation
=
location
;
//[[CLLocation alloc] initWithLatitude:mapView.centerCoordinate.latitude longitude:mapView.centerCoordinate.longitude];
[
geocoder
reverseGeocodeLocation
:
newLocation
completionHandler
:
^
(
NSArray
<
CLPlacemark
*>
*
_Nullable
placemarks
,
NSError
*
_Nullable
error
)
{
if
(
placemarks
.
count
>
0
)
{
CLPlacemark
*
placemark
=
[
placemarks
firstObject
];
//获取城市
NSString
*
city
=
placemark
.
locality
;
if
(
!
city
)
{
//四大直辖市的城市信息无法通过locality获得,只能通过获取省份的方法来获得(如果city为空,则可知为直辖市)
city
=
placemark
.
administrativeArea
;
}
self
.
addressMainTitleLabel
.
text
=
placemark
.
name
;
self
.
addressSubTitleLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@%@%@"
,
placemark
.
subLocality
,
placemark
.
thoroughfare
,
placemark
.
subThoroughfare
?:
@""
];
// 市
NSLog
(
@"locality,%@"
,
placemark
.
addressDictionary
);
}
else
if
(
error
==
nil
&&
[
placemarks
count
]
==
0
)
{
NSLog
(
@"No results were returned."
);
}
else
if
(
error
!=
nil
){
NSLog
(
@"An error occurred = %@"
,
error
);
}
}];
}
//
///* 逆地理编码回调. */
//- (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response {
// if (response.regeocode != nil)
// {
// NSLog(@"formattedDescription: %@", response.regeocode.addressComponent.formattedDescription);
// NSLog(@"formattedAddress: %@", response.regeocode.formattedAddress);
//
//// self.addressComponent = response.regeocode.addressComponent;
// /* 包含 省, 市, 区以及乡镇. */
// self.addressMainTitleLabel.text = response.regeocode.formattedAddress;
// //[NSString stringWithFormat:@"%@%@%@", response.regeocode.addressComponent.province?: @"",
//// response.regeocode.addressComponent.city ?: @"",
//// response.regeocode.addressComponent.district?: @""];
// /* 包含 社区,建筑. */
// self.addressSubTitleLabel.text = [NSString stringWithFormat:@"%@%@",
//// response.regeocode.addressComponent.township?: @"",
//// response.regeocode.addressComponent.neighborhood?: @"",
//// response.regeocode.addressComponent.building?: @"",
// response.regeocode.addressComponent.streetNumber.street,
// response.regeocode.addressComponent.streetNumber.number];
//
// }
//}
-
(
void
)
AMapSearchRequest
:
(
id
)
request
didFailWithError
:
(
NSError
*
)
error
{
NSLog
(
@"Error: %@"
,
error
);
}
/// Description
/// @param slider slider description
-
(
void
)
sliderWillBeginDragging
:
(
SJSlider
*
)
slider
{
...
...
@@ -364,6 +219,12 @@
NSLog
(
@"%f"
,
slider
.
value
);
CGFloat
ss
=
(
slider
.
value
*
800
)
+
200
;
_radius
=
ss
;
[
self
.
mapView
removeOverlays
:
self
.
mapView
.
overlays
];
self
.
circle
=
[
MKCircle
circleWithCenterCoordinate
:
self
.
mapView
.
centerCoordinate
radius
:
_radius
];
[
self
.
mapView
addOverlay
:
self
.
circle
];
[
self
.
mapView
setRegion
:
MKCoordinateRegionMakeWithDistance
(
self
.
mapView
.
centerCoordinate
,
_radius
*
3
,
_radius
*
3
)
animated
:
false
];
// [self.circle setCircleWithCenterCoordinate:self.mapView.centerCoordinate radius: ss];
self
.
distanceTipLabel
.
text
=
[
NSString
stringWithFormat
:
@"%0.fm"
,
ss
];
}
...
...
@@ -372,29 +233,17 @@
sliderDrag
=
YES
;
/// 缩放级别, [3, 20]// [20, 10] [0, 1] [200 , 1000]
CGFloat
ss
=
(
slider
.
value
*
800
)
+
200
;
_radius
=
ss
;
[
self
.
mapView
removeOverlays
:
self
.
mapView
.
overlays
];
self
.
circle
=
[
MKCircle
circleWithCenterCoordinate
:
self
.
mapView
.
centerCoordinate
radius
:
_radius
];
[
self
.
mapView
addOverlay
:
self
.
circle
];
[
self
.
mapView
setRegion
:
MKCoordinateRegionMakeWithDistance
(
self
.
mapView
.
centerCoordinate
,
_radius
*
3
,
_radius
*
3
)
animated
:
false
];
// [self.circle setCircleWithCenterCoordinate:self.mapView.centerCoordinate radius: ss];
self
.
distanceTipLabel
.
text
=
[
NSString
stringWithFormat
:
@"%0.fm"
,
ss
];
}
///// 设置的样式
//- (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id <MAOverlay>)overlay
//{
// if([overlay isKindOfClass:[MACircle class]]) {
//
// MACircleRenderer *circleRenderer = [[MACircleRenderer alloc] initWithCircle:(MACircle *)overlay];
//
// circleRenderer.lineWidth = 2.f;
//
// circleRenderer.strokeColor= [UIColor colorWithHex:0x4299f9];
//
// circleRenderer.fillColor = [[UIColor colorWithHex:0x4299f9] colorWithAlphaComponent: 0.3];
//
// return circleRenderer;
// }
// return nil;
//}
-
(
MKOverlayRenderer
*
)
mapView
:
(
MKMapView
*
)
mapView
rendererForOverlay
:
(
id
<
MKOverlay
>
)
overlay
{
if
([
overlay
isKindOfClass
:[
MKCircle
class
]]){
...
...
ZhiJi/Classes/Map/Controller/ZJMapPinchGestureRecognizer.m
View file @
93f52b23
...
...
@@ -24,7 +24,7 @@
}
if
((
self
=
[
super
initWithTarget
:
self
action
:
@selector
(
handlePinchGesture
)]))
{
self
.
mapView
=
mapView
;
self
.
mapView
=
mapView
;
}
return
self
;
...
...
ZhiJi/Classes/Tools/PCH/ResourceHeader.pch
View file @
93f52b23
...
...
@@ -33,3 +33,10 @@
#define ServerHostFeed @"https://feedapi.linking100.com"
//#endif
//+1 8712341234,1234
//+1 8711223344,9876
//+1 5001128999,8899
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