From 2fb220b286a24a6926ce178262652f8b27ca5232 Mon Sep 17 00:00:00 2001 From: BestKai Date: Mon, 20 Jun 2016 17:23:13 +0800 Subject: [PATCH] 0.0.1 --- GCMessageKit.podspec | 2 - GCMessageKit/Category/MKMapView+Zoomlevel.h | 16 ++ GCMessageKit/Category/MKMapView+Zoomlevel.m | 96 ++++++++ .../GCDisplayLocationViewController.h | 24 -- .../GCDisplayLocationViewController.m | 212 ------------------ .../Controller/GCMessageTableViewController.h | 1 - .../Controller/GCMessageTableViewController.m | 36 +-- GCMessageKitDemo.xcodeproj/project.pbxproj | 16 +- .../GCMessageDemoViewController.m | 44 +++- GCMessageKitDemo/Info.plist | 2 + Podfile | 4 - Podfile.lock | 2 +- Pods/Manifest.lock | 2 +- 13 files changed, 185 insertions(+), 272 deletions(-) create mode 100644 GCMessageKit/Category/MKMapView+Zoomlevel.h create mode 100644 GCMessageKit/Category/MKMapView+Zoomlevel.m delete mode 100644 GCMessageKit/Controller/GCDisplayLocationViewController.h delete mode 100644 GCMessageKit/Controller/GCDisplayLocationViewController.m diff --git a/GCMessageKit.podspec b/GCMessageKit.podspec index 993f983..bae75da 100644 --- a/GCMessageKit.podspec +++ b/GCMessageKit.podspec @@ -14,8 +14,6 @@ Pod::Spec.new do |s| s.dependency 'YYWebImage' s.dependency 'YYText' - s.dependency 'AMap2DMap' - s.dependency 'AMapSearch' s.dependency 'YAssetsPicker' s.dependency 'SVProgressHUD' diff --git a/GCMessageKit/Category/MKMapView+Zoomlevel.h b/GCMessageKit/Category/MKMapView+Zoomlevel.h new file mode 100644 index 0000000..da8fcad --- /dev/null +++ b/GCMessageKit/Category/MKMapView+Zoomlevel.h @@ -0,0 +1,16 @@ +// +// MKMapView+Zoomlevel.h +// GCMessageKitDemo +// +// Created by BestKai on 16/6/20. +// Copyright © 2016年 BestKai. All rights reserved. +// + +#import + +@interface MKMapView (Zoomlevel) + +- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate + zoomLevel:(NSUInteger)zoomLevel + animated:(BOOL)animated; +@end diff --git a/GCMessageKit/Category/MKMapView+Zoomlevel.m b/GCMessageKit/Category/MKMapView+Zoomlevel.m new file mode 100644 index 0000000..3924206 --- /dev/null +++ b/GCMessageKit/Category/MKMapView+Zoomlevel.m @@ -0,0 +1,96 @@ +// +// MKMapView+Zoomlevel.m +// GCMessageKitDemo +// +// Created by BestKai on 16/6/20. +// Copyright © 2016年 BestKai. All rights reserved. +// + +#import "MKMapView+Zoomlevel.h" + +#define MERCATOR_OFFSET 268435456 +#define MERCATOR_RADIUS 85445659.44705395 + +@implementation MKMapView (Zoomlevel) + +#pragma mark - +#pragma mark Map conversion methods + +- (double)longitudeToPixelSpaceX:(double)longitude +{ + return round(MERCATOR_OFFSET + MERCATOR_RADIUS * longitude * M_PI / 180.0); +} + +- (double)latitudeToPixelSpaceY:(double)latitude +{ + return round(MERCATOR_OFFSET - MERCATOR_RADIUS * logf((1 + sinf(latitude * M_PI / 180.0)) / (1 - sinf(latitude * M_PI / 180.0))) / 2.0); +} + +- (double)pixelSpaceXToLongitude:(double)pixelX +{ + return ((round(pixelX) - MERCATOR_OFFSET) / MERCATOR_RADIUS) * 180.0 / M_PI; +} + +- (double)pixelSpaceYToLatitude:(double)pixelY +{ + return (M_PI / 2.0 - 2.0 * atan(exp((round(pixelY) - MERCATOR_OFFSET) / MERCATOR_RADIUS))) * 180.0 / M_PI; +} + +#pragma mark - +#pragma mark Helper methods + +- (MKCoordinateSpan)coordinateSpanWithMapView:(MKMapView *)mapView + centerCoordinate:(CLLocationCoordinate2D)centerCoordinate + andZoomLevel:(NSUInteger)zoomLevel +{ + // convert center coordiate to pixel space + double centerPixelX = [self longitudeToPixelSpaceX:centerCoordinate.longitude]; + double centerPixelY = [self latitudeToPixelSpaceY:centerCoordinate.latitude]; + + // determine the scale value from the zoom level + NSInteger zoomExponent = 20 - zoomLevel; + double zoomScale = pow(2, zoomExponent); + + // scale the map’s size in pixel space + CGSize mapSizeInPixels = mapView.bounds.size; + double scaledMapWidth = mapSizeInPixels.width * zoomScale; + double scaledMapHeight = mapSizeInPixels.height * zoomScale; + + // figure out the position of the top-left pixel + double topLeftPixelX = centerPixelX - (scaledMapWidth / 2); + double topLeftPixelY = centerPixelY - (scaledMapHeight / 2); + + // find delta between left and right longitudes + CLLocationDegrees minLng = [self pixelSpaceXToLongitude:topLeftPixelX]; + CLLocationDegrees maxLng = [self pixelSpaceXToLongitude:topLeftPixelX + scaledMapWidth]; + CLLocationDegrees longitudeDelta = maxLng - minLng; + + // find delta between top and bottom latitudes + CLLocationDegrees minLat = [self pixelSpaceYToLatitude:topLeftPixelY]; + CLLocationDegrees maxLat = [self pixelSpaceYToLatitude:topLeftPixelY + scaledMapHeight]; + CLLocationDegrees latitudeDelta = -1 * (maxLat - minLat); + + // create and return the lat/lng span + MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta); + return span; +} + +#pragma mark - +#pragma mark Public methods + +- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate + zoomLevel:(NSUInteger)zoomLevel + animated:(BOOL)animated +{ + // clamp large numbers to 28 + zoomLevel = MIN(zoomLevel, 28); + + // use the zoom level to compute the region + MKCoordinateSpan span = [self coordinateSpanWithMapView:self centerCoordinate:centerCoordinate andZoomLevel:zoomLevel]; + MKCoordinateRegion region = MKCoordinateRegionMake(centerCoordinate, span); + + // set the region like normal + [self setRegion:region animated:animated]; +} + +@end diff --git a/GCMessageKit/Controller/GCDisplayLocationViewController.h b/GCMessageKit/Controller/GCDisplayLocationViewController.h deleted file mode 100644 index e016ae4..0000000 --- a/GCMessageKit/Controller/GCDisplayLocationViewController.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// GCDisplayLocationViewController.h -// baymax_marketing_iOS -// -// Created by BestKai on 16/1/13. -// Copyright © 2016年 XZ. All rights reserved. -// - -#import -#import "GCMessage.h" -#import -#import - -@interface GCDisplayLocationViewController : UIViewController - - -@property (assign, nonatomic) BOOL needLocation; - -@property (strong, nonatomic) void(^DidGetGeolocationsCompledBlock)(NSString *result,CLLocation *location); - -@property (nonatomic, copy) NSString *address;//地址 -@property (assign,nonatomic) CLLocationCoordinate2D currentCoordinate2D;// 经纬度 - -@end diff --git a/GCMessageKit/Controller/GCDisplayLocationViewController.m b/GCMessageKit/Controller/GCDisplayLocationViewController.m deleted file mode 100644 index 7698415..0000000 --- a/GCMessageKit/Controller/GCDisplayLocationViewController.m +++ /dev/null @@ -1,212 +0,0 @@ -// -// GCDisplayLocationViewController.m -// baymax_marketing_iOS -// -// Created by BestKai on 16/1/13. -// Copyright © 2016年 XZ. All rights reserved. -// - -#import "GCDisplayLocationViewController.h" -#import - -@interface GCDisplayLocationViewController () -{ - AMapReGeocodeSearchResponse *locationResult;//逆地理编码结果 - - MAPointAnnotation *annotationaa; -} -@property (strong, nonatomic) MAMapView *BMapView; -@property (nonatomic, strong) AMapSearchAPI *MapSearch; - -@end - -@implementation GCDisplayLocationViewController - -- (AMapSearchAPI *)MapSearch -{ - if (!_MapSearch) { - _MapSearch = [[AMapSearchAPI alloc] init]; - _MapSearch.delegate = self; - } - return _MapSearch; -} - - -- (MAMapView *)BMapView -{ - if (!_BMapView) { - - _BMapView = [[MAMapView alloc] initWithFrame:self.view.frame]; - _BMapView.zoomLevel = 13.5; - _BMapView.delegate = self; - _BMapView.showsCompass = NO; - if (_needLocation) { - - if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) { - //定位功能不可用, - UIAlertView *alert = [[UIAlertView alloc]init]; - [alert setTitle:@"提示"]; - [alert setMessage:@"设备未打开定位,请在'设置'中为应用打开定位服务"]; - [alert addButtonWithTitle:@"好的"]; - [alert show]; - - }else { - - _BMapView.userTrackingMode = MAUserTrackingModeFollow; - _BMapView.showsUserLocation = YES; - } - }else if (_address){ - - AMapGeocodeSearchRequest *geo = [[AMapGeocodeSearchRequest alloc] init]; - geo.address = _address; - [self.MapSearch AMapGeocodeSearch:geo]; - } - } - return _BMapView; -} - -/** - *用户位置更新后,会调用此函数 - *@param userLocation 新的用户位置 - */ -- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation -{ - if (updatingLocation) { - _currentCoordinate2D = userLocation.location.coordinate; - - [_BMapView setCenterCoordinate:_currentCoordinate2D animated:YES]; - - annotationaa.coordinate = _currentCoordinate2D; - - AMapReGeocodeSearchRequest *reverseGeoCodeOption = [[AMapReGeocodeSearchRequest alloc] init]; - - reverseGeoCodeOption.location = [AMapGeoPoint locationWithLatitude:userLocation.location.coordinate.latitude longitude:userLocation.location.coordinate.longitude];; - [self.MapSearch AMapReGoecodeSearch:reverseGeoCodeOption]; - } -} - -#pragma mark [---- BMKGeoCodeSearchDelegate -//地理编码回调 -- (void)onGeocodeSearchDone:(AMapGeocodeSearchRequest *)request response:(AMapGeocodeSearchResponse *)response -{ - if (response.geocodes.count == 0) { - [SVProgressHUD showErrorWithStatus:@"定位失败"]; - return; - } - - annotationaa = [[MAPointAnnotation alloc] init]; - annotationaa.title = request.address; - AMapGeocode *geoCode = response.geocodes[0]; - annotationaa.coordinate = CLLocationCoordinate2DMake(geoCode.location.latitude, geoCode.location.longitude); - - [self.BMapView setCenterCoordinate:annotationaa.coordinate animated:YES]; - [self.BMapView addAnnotation:annotationaa]; -} - -// 逆地理编码回调 -- (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response -{ - if (response.regeocode !=nil) { - - locationResult = response; - self.navigationItem.rightBarButtonItem.enabled = YES; - } -} - -- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id)annotation -{ - if ([annotation isKindOfClass:[MAPointAnnotation class]]) - { - static NSString *pointReuseIndentifier = @"pointReuseIndentifier"; - MAPinAnnotationView*annotationView = (MAPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndentifier]; - if (annotationView == nil) - { - annotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pointReuseIndentifier]; - } - annotationView.canShowCallout= YES; //设置气泡可以弹出,默认为NO - annotationView.animatesDrop = YES; //设置标注动画显示,默认为NO - annotationView.draggable = YES; //设置标注可以拖动,默认为NO - annotationView.pinColor = MAPinAnnotationColorPurple; - return annotationView; - } - return nil; -} - -- (void)loadLocations { - - if (_address) { - annotationaa.title = _address; - } - - annotationaa = [[MAPointAnnotation alloc] init]; - [_BMapView addAnnotation:annotationaa]; - annotationaa.coordinate = _currentCoordinate2D; - [_BMapView setCenterCoordinate:_currentCoordinate2D animated:YES]; -} -#pragma mark - Life cycle - -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; - - if (!self.needLocation && !_address) { - [self loadLocations]; - } -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - _BMapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放 - self.MapSearch.delegate = self; - [self.navigationController setNavigationBarHidden:NO animated:animated]; -} - --(void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - _BMapView.delegate = nil; - self.MapSearch.delegate = nil; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view. - self.title = @"地理位置"; - - self.view.backgroundColor = [UIColor whiteColor]; - - [self.view addSubview:self.BMapView]; - - - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"backImage"] style:UIBarButtonItemStylePlain target:self action:@selector(back)]; - - if (self.needLocation) { - - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"发送" style:UIBarButtonItemStylePlain target:self action:@selector(sendLocation)]; - self.navigationItem.rightBarButtonItem.enabled = NO; - } -} - -- (void)sendLocation -{ - if (self.DidGetGeolocationsCompledBlock) { - self.DidGetGeolocationsCompledBlock(locationResult.regeocode.formattedAddress,[[CLLocation alloc] initWithLatitude:_currentCoordinate2D.latitude longitude:_currentCoordinate2D.longitude]); - } - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - - [self.navigationController popViewControllerAnimated:YES]; - }); -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -- (void)dealloc { -} - -- (void)back -{ - [self.navigationController popViewControllerAnimated:YES]; -} -@end diff --git a/GCMessageKit/Controller/GCMessageTableViewController.h b/GCMessageKit/Controller/GCMessageTableViewController.h index 6eb96ae..933e85c 100644 --- a/GCMessageKit/Controller/GCMessageTableViewController.h +++ b/GCMessageKit/Controller/GCMessageTableViewController.h @@ -20,7 +20,6 @@ #import "GCOtherMessageInputView.h" #import "GCTakePhotographHelper.h" #import "YImagePickerNavController.h" -#import "GCDisplayLocationViewController.h" #import "GCVoiceRecordHelper.h" #import "GCAddressBookHelper.h" diff --git a/GCMessageKit/Controller/GCMessageTableViewController.m b/GCMessageKit/Controller/GCMessageTableViewController.m index 3b59fc4..8880d47 100644 --- a/GCMessageKit/Controller/GCMessageTableViewController.m +++ b/GCMessageKit/Controller/GCMessageTableViewController.m @@ -361,24 +361,24 @@ - (void)clickToOpenAlbumView [self.imagePickerNavController showFirstAssetsController]; } #pragma mark ----- 定位 -- (void)clickGetAddressView -{ - GCDisplayLocationViewController *displayLocationViewController = [[GCDisplayLocationViewController alloc] init]; - - displayLocationViewController.needLocation = YES; - - WEAKSELF - displayLocationViewController.DidGetGeolocationsCompledBlock = ^(NSString *result,CLLocation *location) - { - if (result) { - NSString *geoLocations = result; - if (geoLocations) { - [weakSelf didSendGeolocationsMessageWithGeolocaltions:geoLocations location:location]; - } - } - }; - [self.navigationController pushViewController:displayLocationViewController animated:YES]; -} +//- (void)clickGetAddressView +//{ +// GCDisplayLocationViewController *displayLocationViewController = [[GCDisplayLocationViewController alloc] init]; +// +// displayLocationViewController.needLocation = YES; +// +// WEAKSELF +// displayLocationViewController.DidGetGeolocationsCompledBlock = ^(NSString *result,CLLocation *location) +// { +// if (result) { +// NSString *geoLocations = result; +// if (geoLocations) { +// [weakSelf didSendGeolocationsMessageWithGeolocaltions:geoLocations location:location]; +// } +// } +// }; +// [self.navigationController pushViewController:displayLocationViewController animated:YES]; +//} #pragma mark ----- 名片 - (void)clickOpenBusinessCardView diff --git a/GCMessageKitDemo.xcodeproj/project.pbxproj b/GCMessageKitDemo.xcodeproj/project.pbxproj index 4da8eef..5f516e4 100644 --- a/GCMessageKitDemo.xcodeproj/project.pbxproj +++ b/GCMessageKitDemo.xcodeproj/project.pbxproj @@ -25,7 +25,6 @@ E2C13AC71D1775C500EDE287 /* GCPhotoMessageHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C139F31D1775C400EDE287 /* GCPhotoMessageHelper.m */; }; E2C13AC81D1775C500EDE287 /* GCTakePhotographHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C139F51D1775C400EDE287 /* GCTakePhotographHelper.m */; }; E2C13AC91D1775C500EDE287 /* GCVoiceRecordHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C139F71D1775C400EDE287 /* GCVoiceRecordHelper.m */; }; - E2C13ACA1D1775C500EDE287 /* GCDisplayLocationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C139FA1D1775C400EDE287 /* GCDisplayLocationViewController.m */; }; E2C13ACB1D1775C500EDE287 /* GCDisplayMediaViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C139FC1D1775C400EDE287 /* GCDisplayMediaViewController.m */; }; E2C13ACC1D1775C500EDE287 /* GCDisplayTextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C139FE1D1775C400EDE287 /* GCDisplayTextViewController.m */; }; E2C13ACD1D1775C500EDE287 /* GCMessageTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C13A001D1775C400EDE287 /* GCMessageTableViewController.m */; }; @@ -187,6 +186,8 @@ E2C13B6A1D1775C500EDE287 /* 黑线@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = E2C13ABD1D1775C500EDE287 /* 黑线@3x.png */; }; E2C13B6D1D17827300EDE287 /* UIView+GCAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C13B6C1D17827300EDE287 /* UIView+GCAdd.m */; }; E2C13BC01D179FE800EDE287 /* GCMessageDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C13BBF1D179FE800EDE287 /* GCMessageDemoViewController.m */; }; + E2C13BC21D17D57700EDE287 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2C13BC11D17D57700EDE287 /* CoreLocation.framework */; }; + E2C13BC51D17E91000EDE287 /* MKMapView+Zoomlevel.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C13BC41D17E91000EDE287 /* MKMapView+Zoomlevel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -225,8 +226,6 @@ E2C139F51D1775C400EDE287 /* GCTakePhotographHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCTakePhotographHelper.m; sourceTree = ""; }; E2C139F61D1775C400EDE287 /* GCVoiceRecordHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCVoiceRecordHelper.h; sourceTree = ""; }; E2C139F71D1775C400EDE287 /* GCVoiceRecordHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCVoiceRecordHelper.m; sourceTree = ""; }; - E2C139F91D1775C400EDE287 /* GCDisplayLocationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCDisplayLocationViewController.h; sourceTree = ""; }; - E2C139FA1D1775C400EDE287 /* GCDisplayLocationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCDisplayLocationViewController.m; sourceTree = ""; }; E2C139FB1D1775C400EDE287 /* GCDisplayMediaViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCDisplayMediaViewController.h; sourceTree = ""; }; E2C139FC1D1775C400EDE287 /* GCDisplayMediaViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCDisplayMediaViewController.m; sourceTree = ""; }; E2C139FD1D1775C400EDE287 /* GCDisplayTextViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCDisplayTextViewController.h; sourceTree = ""; }; @@ -416,6 +415,9 @@ E2C13BBD1D1799E000EDE287 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; E2C13BBE1D179FE800EDE287 /* GCMessageDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCMessageDemoViewController.h; sourceTree = ""; }; E2C13BBF1D179FE800EDE287 /* GCMessageDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCMessageDemoViewController.m; sourceTree = ""; }; + E2C13BC11D17D57700EDE287 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + E2C13BC31D17E91000EDE287 /* MKMapView+Zoomlevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MKMapView+Zoomlevel.h"; sourceTree = ""; }; + E2C13BC41D17E91000EDE287 /* MKMapView+Zoomlevel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MKMapView+Zoomlevel.m"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -423,6 +425,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + E2C13BC21D17D57700EDE287 /* CoreLocation.framework in Frameworks */, 1CDBE0287AFABFC6691C4A74 /* libPods-GCMessageKitDemo.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -433,6 +436,7 @@ 087805F011D1BB0AB46793ED /* Frameworks */ = { isa = PBXGroup; children = ( + E2C13BC11D17D57700EDE287 /* CoreLocation.framework */, 74AF426EAFCBC5871B9C8CB4 /* libPods-GCMessageKitDemo.a */, ); name = Frameworks; @@ -522,6 +526,8 @@ E2C139E61D1775C400EDE287 /* UIImage+Resize.m */, E2C139E71D1775C400EDE287 /* UIImage+RoundedCorner.h */, E2C139E81D1775C400EDE287 /* UIImage+RoundedCorner.m */, + E2C13BC31D17E91000EDE287 /* MKMapView+Zoomlevel.h */, + E2C13BC41D17E91000EDE287 /* MKMapView+Zoomlevel.m */, ); path = Category; sourceTree = ""; @@ -550,8 +556,6 @@ E2C139F81D1775C400EDE287 /* Controller */ = { isa = PBXGroup; children = ( - E2C139F91D1775C400EDE287 /* GCDisplayLocationViewController.h */, - E2C139FA1D1775C400EDE287 /* GCDisplayLocationViewController.m */, E2C139FB1D1775C400EDE287 /* GCDisplayMediaViewController.h */, E2C139FC1D1775C400EDE287 /* GCDisplayMediaViewController.m */, E2C139FD1D1775C400EDE287 /* GCDisplayTextViewController.h */, @@ -1071,6 +1075,7 @@ E2C13AD61D1775C500EDE287 /* WBVoiceRecordHUD.m in Sources */, E2C13ADD1D1775C500EDE287 /* GCMessage.m in Sources */, E2C13AC51D1775C500EDE287 /* GCMessageBubbleHelper.m in Sources */, + E2C13BC51D17E91000EDE287 /* MKMapView+Zoomlevel.m in Sources */, E2C13AD31D1775C500EDE287 /* GCEmotionMangerView.m in Sources */, E2C13AD21D1775C500EDE287 /* GCEmotionManager.m in Sources */, E2C139CE1D1771B500EDE287 /* ViewController.m in Sources */, @@ -1087,7 +1092,6 @@ E2C13ADF1D1775C500EDE287 /* GCHeaderContainerView.m in Sources */, E2C13ACC1D1775C500EDE287 /* GCDisplayTextViewController.m in Sources */, E2C13ADA1D1775C500EDE287 /* GCPhotoMessageTableViewCell.m in Sources */, - E2C13ACA1D1775C500EDE287 /* GCDisplayLocationViewController.m in Sources */, E2C13AE31D1775C500EDE287 /* YYControl.m in Sources */, E2C13AD11D1775C500EDE287 /* GCEmotionCollectionViewCell.m in Sources */, E2C13AE21D1775C500EDE287 /* GCNameCardView.m in Sources */, diff --git a/GCMessageKitDemo/GCMessageDemoViewController.m b/GCMessageKitDemo/GCMessageDemoViewController.m index c96d32d..d3483fd 100644 --- a/GCMessageKitDemo/GCMessageDemoViewController.m +++ b/GCMessageKitDemo/GCMessageDemoViewController.m @@ -16,6 +16,23 @@ - (void)viewDidLoad [super viewDidLoad]; // [self setBackgroundColor:[UIColor colorWithRed:243/255.0 green:243/255.0 blue:243/255.0 alpha:1.0]]; + self.allowsSendMultiMedia = YES; + self.allowsSendVoice = YES; + + NSMutableArray *shareMenus = [[NSMutableArray alloc] init]; + NSArray *plugIcons; + NSArray *plugTitle; + + plugIcons = @[@"sharemore_pic", @"sharemore_video",@"sharemore_location",@"sharemore_card"]; + plugTitle = @[@"照片", @"拍摄",@"位置",@"名片"]; + + for (NSString *plugIcon in plugIcons) { + GCOtherMenuItem *shareMenuItem = [[GCOtherMenuItem alloc] initWithNormalIconImage:[UIImage imageNamed:plugIcon] title:[plugTitle objectAtIndex:[plugIcons indexOfObject:plugIcon]]]; + [shareMenus addObject:shareMenuItem]; + } + + self.shareMenuItems = shareMenus; + self.toImageUrl = @"http://tx.haiqq.com/qqtouxiang/uploads/2014-04-08/011438126.jpg"; self.fromImageUrl = @"http://img.jiqie.com/11/6/1524mj.jpg"; @@ -227,9 +244,9 @@ - (void)didSelectedOnCell:(GCMessageBaseTableViewCell *)cell break; case GCMessageTypeLocation: { - GCDisplayLocationViewController *locationVC = [[GCDisplayLocationViewController alloc] init]; -// locationVC.message = message; - disPlayViewController = locationVC; +// GCDisplayLocationViewController *locationVC = [[GCDisplayLocationViewController alloc] init]; +//// locationVC.message = message; +// disPlayViewController = locationVC; } break; case GCMessageTypeNameCard: @@ -247,6 +264,27 @@ - (void)didSelectedOnCell:(GCMessageBaseTableViewCell *)cell } } + +- (void)clickGetAddressView +{ +// GCDisplayLocationViewController *displayLocationViewController = [[GCDisplayLocationViewController alloc] init]; +// +// displayLocationViewController.needLocation = YES; +// +// WEAKSELF +// displayLocationViewController.DidGetGeolocationsCompledBlock = ^(NSString *result,CLLocation *location) +// { +// if (result) { +// NSString *geoLocations = result; +// if (geoLocations) { +// [weakSelf didSendGeoLocationsPhoto:[UIImage imageNamed:@"Fav_Cell_Loc"] geolocations:result location:location fromSender:@"" onDate:[NSDate date]]; +// } +// } +// }; +// [self.navigationController pushViewController:displayLocationViewController animated:YES]; + +} + - (void)avatarImageViewTapped { NSLog(@"点击了头像"); diff --git a/GCMessageKitDemo/Info.plist b/GCMessageKitDemo/Info.plist index db26bc0..2460367 100644 --- a/GCMessageKitDemo/Info.plist +++ b/GCMessageKitDemo/Info.plist @@ -2,6 +2,8 @@ + NSLocationWhenInUseUsageDescription + NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/Podfile b/Podfile index 4cd7d3b..86e1783 100755 --- a/Podfile +++ b/Podfile @@ -8,10 +8,6 @@ target :GCMessageKitDemo do pod "YYWebImage" pod "YYText" - -pod "AMap2DMap" -pod "AMapSearch" - pod "YAssetsPicker" pod "SVProgressHUD" diff --git a/Podfile.lock b/Podfile.lock index 9240826..f96e4a6 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -34,6 +34,6 @@ SPEC CHECKSUMS: YYText: ac09660c9ccd9b817f409a20caa6f5587444d2ae YYWebImage: 0431ed108e104527669b86f75efd58958425cca2 -PODFILE CHECKSUM: e99b7a61fd2490c3885d458e5ce09c2a66e3a1e5 +PODFILE CHECKSUM: 600c88be8aa52f0918b52b16a0a46242b2e7d5b2 COCOAPODS: 1.0.1 diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock index 9240826..f96e4a6 100644 --- a/Pods/Manifest.lock +++ b/Pods/Manifest.lock @@ -34,6 +34,6 @@ SPEC CHECKSUMS: YYText: ac09660c9ccd9b817f409a20caa6f5587444d2ae YYWebImage: 0431ed108e104527669b86f75efd58958425cca2 -PODFILE CHECKSUM: e99b7a61fd2490c3885d458e5ce09c2a66e3a1e5 +PODFILE CHECKSUM: 600c88be8aa52f0918b52b16a0a46242b2e7d5b2 COCOAPODS: 1.0.1