Commit dd17385f authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

no message

parent 62d37206
No preview for this file type
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
A948C4DA24977B3700C22D69 /* ZJFriendLocationRemindModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A948C4D924977B3700C22D69 /* ZJFriendLocationRemindModel.m */; }; A948C4DA24977B3700C22D69 /* ZJFriendLocationRemindModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A948C4D924977B3700C22D69 /* ZJFriendLocationRemindModel.m */; };
A948C4DF249A27FE00C22D69 /* ZJOauthLoginConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = A948C4DE249A27FE00C22D69 /* ZJOauthLoginConfig.m */; }; A948C4DF249A27FE00C22D69 /* ZJOauthLoginConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = A948C4DE249A27FE00C22D69 /* ZJOauthLoginConfig.m */; };
A948C504249B887B00C22D69 /* ZJGoodsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A948C503249B887B00C22D69 /* ZJGoodsModel.m */; }; A948C504249B887B00C22D69 /* ZJGoodsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A948C503249B887B00C22D69 /* ZJGoodsModel.m */; };
A94EE53324D401EB0046038D /* ZJCustomAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = A94EE53124D401EB0046038D /* ZJCustomAnnotation.m */; };
A95590932490AE3C00F3BB41 /* QJGIFView.m in Sources */ = {isa = PBXBuildFile; fileRef = A955908D2490AE3C00F3BB41 /* QJGIFView.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 */; }; A95590942490AE3C00F3BB41 /* MBProgressHUD+MJ.m in Sources */ = {isa = PBXBuildFile; fileRef = A955908E2490AE3C00F3BB41 /* MBProgressHUD+MJ.m */; };
A95590952490AE3C00F3BB41 /* MBProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = A95590902490AE3C00F3BB41 /* MBProgressHUD.bundle */; }; A95590952490AE3C00F3BB41 /* MBProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = A95590902490AE3C00F3BB41 /* MBProgressHUD.bundle */; };
...@@ -281,6 +282,8 @@ ...@@ -281,6 +282,8 @@
A948C4DE249A27FE00C22D69 /* ZJOauthLoginConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZJOauthLoginConfig.m; sourceTree = "<group>"; }; A948C4DE249A27FE00C22D69 /* ZJOauthLoginConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZJOauthLoginConfig.m; sourceTree = "<group>"; };
A948C502249B887B00C22D69 /* ZJGoodsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZJGoodsModel.h; sourceTree = "<group>"; }; A948C502249B887B00C22D69 /* ZJGoodsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZJGoodsModel.h; sourceTree = "<group>"; };
A948C503249B887B00C22D69 /* ZJGoodsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZJGoodsModel.m; sourceTree = "<group>"; }; 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>"; };
A955908B2490AE3C00F3BB41 /* MBProgressHUD+MJ.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MBProgressHUD+MJ.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>"; }; 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>"; }; A955908E2490AE3C00F3BB41 /* MBProgressHUD+MJ.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MBProgressHUD+MJ.m"; sourceTree = "<group>"; };
...@@ -1081,6 +1084,8 @@ ...@@ -1081,6 +1084,8 @@
A9619E7F24AAE2A8009A2012 /* ZJMapStyle2ViewController.m */, A9619E7F24AAE2A8009A2012 /* ZJMapStyle2ViewController.m */,
64F52440248F34DB0032BCA2 /* ZJFriendTrackMapViewController.h */, 64F52440248F34DB0032BCA2 /* ZJFriendTrackMapViewController.h */,
64F52441248F34DB0032BCA2 /* ZJFriendTrackMapViewController.m */, 64F52441248F34DB0032BCA2 /* ZJFriendTrackMapViewController.m */,
A94EE53224D401EB0046038D /* ZJCustomAnnotation.h */,
A94EE53124D401EB0046038D /* ZJCustomAnnotation.m */,
); );
path = Controller; path = Controller;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1552,6 +1557,7 @@ ...@@ -1552,6 +1557,7 @@
A95F5C62248DDE81001DB97E /* UILabel+HExtension.m in Sources */, A95F5C62248DDE81001DB97E /* UILabel+HExtension.m in Sources */,
A95F5C61248DDE81001DB97E /* UIView+HExtension.m in Sources */, A95F5C61248DDE81001DB97E /* UIView+HExtension.m in Sources */,
A948C4782493578A00C22D69 /* ZJFriendModel.m in Sources */, A948C4782493578A00C22D69 /* ZJFriendModel.m in Sources */,
A94EE53324D401EB0046038D /* ZJCustomAnnotation.m in Sources */,
A9619E8224AAE2A8009A2012 /* ZJBaseMapViewController.m in Sources */, A9619E8224AAE2A8009A2012 /* ZJBaseMapViewController.m in Sources */,
D5271ED324907E6100F8B107 /* ZJLocationAttentionFooter.swift in Sources */, D5271ED324907E6100F8B107 /* ZJLocationAttentionFooter.swift in Sources */,
A95F5C98248DDE81001DB97E /* ZJPhoneLoginViewController.m in Sources */, A95F5C98248DDE81001DB97E /* ZJPhoneLoginViewController.m in Sources */,
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
// //
#import "ZJBaseMapViewController.h" #import "ZJBaseMapViewController.h"
#import <MapKit/MapKit.h>
#import "ZJCustomAnnotation.h"
@interface ZJBaseMapViewController ()<MAMapViewDelegate, XMPopupListViewDelegate> @interface ZJBaseMapViewController ()<XMPopupListViewDelegate, MKMapViewDelegate>
@property (nonatomic, strong) MAMapView *mapView; @property (nonatomic, strong) MKMapView *mapView;
@property (nonatomic, strong) UIButton *gpsButton;
@property (nonatomic, strong) ZJMapViewPersonCardView *cardView; @property (nonatomic, strong) ZJMapViewPersonCardView *cardView;
...@@ -25,12 +26,10 @@ ...@@ -25,12 +26,10 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view.
[self setupUI];
self.friendDataSource = [NSMutableArray array]; self.friendDataSource = [NSMutableArray array];
[self setupUI];
[self getFriendList]; [self getFriendList];
} }
...@@ -49,26 +48,15 @@ ...@@ -49,26 +48,15 @@
- (void)setupUI{ - (void)setupUI{
///初始化地图 ///初始化地图
self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; self.mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
_mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _mapView.showsUserLocation = YES;
///把地图添加至view _mapView.userTrackingMode = MKUserTrackingModeFollow;
[self.view addSubview: _mapView];
self.mapView.mapType = 0;
_mapView.showsWorldMap = @YES;
[self.mapView performSelector:@selector(setShowsWorldMap:) withObject:@(YES)];
if ([ZJUserInfoManager CNLanguage]) {
self.mapView.mapLanguage = @0;
[self.mapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(0)];
}else{
self.mapView.mapLanguage = @1;
[self.mapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(1)];
}
_mapView.delegate = self; _mapView.delegate = self;
_mapView.zoomLevel = 14;
_mapView.showsScale = false; _mapView.showsScale = false;
_mapView.showsCompass = false; _mapView.showsCompass = false;
_mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
///把地图添加至view
[self.view addSubview: _mapView];
// 添加 card view // 添加 card view
self.cardView = [[[NSBundle mainBundle] loadNibNamed:@"ZJMapViewPersonCardView" owner:self options:nil] lastObject]; self.cardView = [[[NSBundle mainBundle] loadNibNamed:@"ZJMapViewPersonCardView" owner:self options:nil] lastObject];
...@@ -120,30 +108,6 @@ ...@@ -120,30 +108,6 @@
}; };
} }
- (void)mapView:(UIView *)mapView regionDidChangeAnimated:(BOOL)animated {
// if(mapView.isHidden) {
// return;
// }
//
// if(self.isSwitching) {
// self.isSwitching = NO;
// return;
// }
// [self.mapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(1)];
// [self.mapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(0)];
if([mapView isKindOfClass:[MAMapView class]]) {
if(!AMapDataAvailableForCoordinate(self.mapView.centerCoordinate)) {
}
} else {
if(AMapDataAvailableForCoordinate(self.mapView.centerCoordinate)) {
}
}
}
#pragma mark 好友列表 #pragma mark 好友列表
- (void)getFriendList{ - (void)getFriendList{
...@@ -151,7 +115,7 @@ ...@@ -151,7 +115,7 @@
//未登录 //未登录
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码 ///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
_mapView.showsUserLocation = YES; _mapView.showsUserLocation = YES;
_mapView.userTrackingMode = MAUserTrackingModeFollow; _mapView.userTrackingMode = MKUserTrackingModeFollow;
return; return;
} }
[self.friendDataSource removeAllObjects]; [self.friendDataSource removeAllObjects];
...@@ -172,7 +136,7 @@ ...@@ -172,7 +136,7 @@
[weakSelf.style2BgImV setHidden:false]; [weakSelf.style2BgImV setHidden:false];
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码 ///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
weakSelf.mapView.showsUserLocation = YES; weakSelf.mapView.showsUserLocation = YES;
weakSelf.mapView.userTrackingMode = MAUserTrackingModeFollow; weakSelf.mapView.userTrackingMode = MKUserTrackingModeFollow;
} else { } else {
[weakSelf.cardView setHidden:false]; [weakSelf.cardView setHidden:false];
[weakSelf.addCareButton setHidden:true]; [weakSelf.addCareButton setHidden:true];
...@@ -198,7 +162,7 @@ ...@@ -198,7 +162,7 @@
} }
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码 ///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
weakSelf.mapView.showsUserLocation = YES; weakSelf.mapView.showsUserLocation = YES;
weakSelf.mapView.userTrackingMode = MAUserTrackingModeFollow; weakSelf.mapView.userTrackingMode = MKUserTrackingModeFollow;
// [MBProgressHUD showError:[NSString stringWithFormat:@"获取好友列表失败\n%@", [response objectForKey:@"msg"]] toView:self.view]; // [MBProgressHUD showError:[NSString stringWithFormat:@"获取好友列表失败\n%@", [response objectForKey:@"msg"]] toView:self.view];
} }
...@@ -206,13 +170,6 @@ ...@@ -206,13 +170,6 @@
// [MBProgressHUD showError:[NSString stringWithFormat:@"获取好友列表失败\n%@", error.description] toView:self.view]; // [MBProgressHUD showError:[NSString stringWithFormat:@"获取好友列表失败\n%@", error.description] toView:self.view];
}]; }];
} }
#pragma mark - Action Handlers
- (void)returnAction
{
[self.navigationController popViewControllerAnimated:YES];
}
/** /**
选中cell后回调 选中cell后回调
@param indexPath 返回选中的indexPath @param indexPath 返回选中的indexPath
...@@ -249,13 +206,15 @@ ...@@ -249,13 +206,15 @@
double lat = [response[@"result"][@"data"][@"lat"] doubleValue]; double lat = [response[@"result"][@"data"][@"lat"] doubleValue];
double lon = [response[@"result"][@"data"][@"lon"] doubleValue]; double lon = [response[@"result"][@"data"][@"lon"] doubleValue];
MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init];
ZJCustomAnnotation *pointAnnotation = [[ZJCustomAnnotation alloc] init];
pointAnnotation.coordinate = CLLocationCoordinate2DMake(lat, lon); pointAnnotation.coordinate = CLLocationCoordinate2DMake(lat, lon);
pointAnnotation.title = @"latestLocation"; pointAnnotation.title = @"latestLocation";
[_self.mapView addAnnotation:pointAnnotation]; [_self.mapView addAnnotation:pointAnnotation];
[_self.mapView setCenterCoordinate:pointAnnotation.coordinate animated:false]; [_self.mapView setCenterCoordinate:pointAnnotation.coordinate animated:false];
}else if ([[response objectForKey:@"status"] integerValue] == 105) { }else{
[MBProgressHUD showError:[response objectForKey:@"msg"] toView:self.view]; [MBProgressHUD showError:[response objectForKey:@"msg"] toView:self.view];
} }
...@@ -266,13 +225,26 @@ ...@@ -266,13 +225,26 @@
} }
#pragma mark - Map Delegate #pragma mark - Map Delegate
- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation { - (nullable MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{
if([annotation isKindOfClass:[MAPointAnnotation class]]) { if([annotation isKindOfClass:[ZJCustomAnnotation class]]) {
NSString *pointReuseIndetifier = @"pointReuseIndetifier3";
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndetifier];
if (annotationView == nil) {
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndetifier];
annotationView.canShowCallout = YES;
}
annotationView.image = [UIImage imageNamed:@"userPosition"];
annotationView.enabled = NO;
return annotationView;
}
else if([annotation isKindOfClass:[MKUserLocation class]]){
NSString *pointReuseIndetifier = @"pointReuseIndetifier3"; NSString *pointReuseIndetifier = @"pointReuseIndetifier3";
MAAnnotationView *annotationView = (MAAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndetifier]; MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndetifier];
if (annotationView == nil) { if (annotationView == nil) {
annotationView = [[MAAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndetifier]; annotationView = [[MKAnnotationView alloc] initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:pointReuseIndetifier];
annotationView.canShowCallout = YES; annotationView.canShowCallout = YES;
} }
......
//
// ZJCustomAnnotation.h
// ZhiJi
//
// Created by 明津李 on 2020/7/27.
// Copyright © 2020 Company. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZJCustomAnnotation : NSObject<MKAnnotation>
@property (nonatomic) CLLocationCoordinate2D coordinate;
@property (nonatomic,copy) NSString * title;
@property (nonatomic,copy) NSString * subtitle;
@end
NS_ASSUME_NONNULL_END
//
// ZJCustomAnnotation.m
// ZhiJi
//
// Created by 明津李 on 2020/7/27.
// Copyright © 2020 Company. All rights reserved.
//
#import "ZJCustomAnnotation.h"
@implementation ZJCustomAnnotation
@end
//
// ZJMapPinchGestureRecognizer.h
// ZhiJi
//
// Created by 明津李 on 2020/7/28.
// Copyright © 2020 Company. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZJMapPinchGestureRecognizer : UIPinchGestureRecognizer
- (id)initWithMapView:(MKMapView *)mapView;
@end
NS_ASSUME_NONNULL_END
//
// ZJMapPinchGestureRecognizer.m
// ZhiJi
//
// Created by 明津李 on 2020/7/28.
// Copyright © 2020 Company. All rights reserved.
//
#import "ZJMapPinchGestureRecognizer.h"
@interface ZJMapPinchGestureRecognizer ()
- (void)handlePinchGesture;
@property (nonatomic, assign) MKMapView *mapView;
@end
@implementation ZJMapPinchGestureRecognizer
- (id)initWithMapView:(MKMapView *)mapView {
if (mapView == nil) {
[NSException raise:NSInvalidArgumentException format:@"mapView cannot be nil."];
}
if ((self = [super initWithTarget:self action:@selector(handlePinchGesture)])) {
self.mapView = mapView;
}
return self;
}
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer {
return NO;
}
- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer {
return NO;
}
- (void)handlePinchGesture {
CLLocation *location = self.mapView.userLocation.location;
if (location != nil) {
[self.mapView setCenterCoordinate:location.coordinate];
}
}
@end
...@@ -38,12 +38,6 @@ ...@@ -38,12 +38,6 @@
} }
- (IBAction)drawTrackAction:(UIButton *)sender { - (IBAction)drawTrackAction:(UIButton *)sender {
if ([self.stratDate compare:self.endDate] == NSOrderedDescending) {
[MBProgressHUD showError:kLocalizedString(@"track_start_time_less_end")];
return;
}
if (_drawTrackHandle) { if (_drawTrackHandle) {
_drawTrackHandle(); _drawTrackHandle();
} }
...@@ -57,10 +51,10 @@ ...@@ -57,10 +51,10 @@
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
datePciker.commitTrackDateClosre = ^(NSDate *date) { datePciker.commitTrackDateClosre = ^(NSDate *date) {
NSLog(@"%@", date); NSLog(@"%@", date);
// if ([date compare:weakSelf.endDate] == NSOrderedDescending) { if ([date compare:weakSelf.endDate] == NSOrderedDescending) {
// [MBProgressHUD showError:kLocalizedString(@"track_start_time_less_end")]; [MBProgressHUD showError:kLocalizedString(@"track_start_time_less_end")];
// return; return;
// } }
[weakSelf.beginTimeButton setTitle: [weakSelf getDateStringFromDate:date] forState:UIControlStateNormal]; [weakSelf.beginTimeButton setTitle: [weakSelf getDateStringFromDate:date] forState:UIControlStateNormal];
weakSelf.stratDate = date; weakSelf.stratDate = date;
if (weakSelf.dateSelectFinishedHandle) { if (weakSelf.dateSelectFinishedHandle) {
...@@ -79,10 +73,10 @@ ...@@ -79,10 +73,10 @@
datePciker.commitTrackDateClosre = ^(NSDate *date) { datePciker.commitTrackDateClosre = ^(NSDate *date) {
NSLog(@"endTime %@", date); NSLog(@"endTime %@", date);
// if ([date compare:weakSelf.stratDate] == NSOrderedAscending) { if ([date compare:weakSelf.stratDate] == NSOrderedAscending) {
// [MBProgressHUD showError:kLocalizedString(@"track_end_time_great_start")]; [MBProgressHUD showError:kLocalizedString(@"track_end_time_great_start")];
// return; return;
// } }
weakSelf.endDate = date; weakSelf.endDate = date;
[weakSelf.endTimeButton setTitle: [weakSelf getDateStringFromDate:date] forState:UIControlStateNormal]; [weakSelf.endTimeButton setTitle: [weakSelf getDateStringFromDate:date] forState:UIControlStateNormal];
......
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