Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ DerivedData
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
#Pods/
Pods/
20 changes: 16 additions & 4 deletions Example/Classes/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ViewController.h"
#import "DBMapSelectorManager.h"

@interface ViewController () <UIPickerViewDataSource, UIPickerViewDelegate, DBMapSelectorManagerDelegate> {
@interface ViewController () <UIPickerViewDataSource, UIPickerViewDelegate, DBMapSelectorManagerDelegate, DBMapSelectorManagerDataSource> {
NSDictionary *_fillColorDict;
NSDictionary *_strokeColorDict;
UIPickerView *_fillColorPickerView;
Expand All @@ -26,6 +26,7 @@ - (DBMapSelectorManager *)mapSelectorManager {
if (nil == _mapSelectorManager) {
_mapSelectorManager = [[DBMapSelectorManager alloc] initWithMapView:self.mapView];
_mapSelectorManager.delegate = self;
_mapSelectorManager.dataSource = self;
}
return _mapSelectorManager;
}
Expand All @@ -39,9 +40,7 @@ - (void)viewDidLoad {

// Set map selector settings
self.mapSelectorManager.circleCoordinate = CLLocationCoordinate2DMake(55.75399400, 37.62209300);
self.mapSelectorManager.circleRadius = 3000;
self.mapSelectorManager.circleRadiusMax = 25000;
[self.mapSelectorManager applySelectorSettings];
self.mapSelectorManager.circleRadiusFillOutside = 1000;

_fillColorDict = @{@"Orange": [UIColor orangeColor], @"Green": [UIColor greenColor], @"Pure": [UIColor purpleColor], @"Cyan": [UIColor cyanColor], @"Yellow": [UIColor yellowColor], @"Magenta": [UIColor magentaColor]};
_strokeColorDict = @{@"Dark Gray": [UIColor darkGrayColor], @"Black": [UIColor blackColor], @"Brown": [UIColor brownColor], @"Red": [UIColor redColor], @"Blue": [UIColor blueColor]};
Expand Down Expand Up @@ -99,11 +98,24 @@ - (IBAction)hiddenSwitchValueDidChange:(UISwitch *)sender {

- (void)mapSelectorManager:(DBMapSelectorManager *)mapSelectorManager didChangeCoordinate:(CLLocationCoordinate2D)coordinate {
_coordinateLabel.text = [NSString stringWithFormat:@"Coordinate = {%.5f, %.5f}", coordinate.latitude, coordinate.longitude];
self.mapSelectorManager.title = _coordinateLabel.text;
[self.mapSelectorManager applySelectorSettings];
}

- (void)mapSelectorManager:(DBMapSelectorManager *)mapSelectorManager didChangeRadius:(CLLocationDistance)radius {
NSString *radiusStr = (radius >= 1000) ? [NSString stringWithFormat:@"%.1f km", radius * .001f] : [NSString stringWithFormat:@"%.0f m", radius];
_radiusLabel.text = [@"Radius = " stringByAppendingString:radiusStr];
self.mapSelectorManager.subtitle = _radiusLabel.text;
[self.mapSelectorManager applySelectorSettings];
}

#pragma mark - DBMapSelectorManager DataSource

- (UIView *)mapSelectorManagerRightCalloutAccessoryView {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
[button setTitle:@"Button" forState:UIControlStateNormal];
[button setFrame:CGRectMake(0, 0, 62, 31)];
return button;
}

#pragma mark - UIPickerView Delegate && DataSource
Expand Down
107 changes: 56 additions & 51 deletions Example/DBMapSelectorViewControllerExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@
objects = {

/* Begin PBXBuildFile section */
A40D268C1AE2967B00A511E0 /* DBMapSelectorAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = A40D268B1AE2967B00A511E0 /* DBMapSelectorAnnotation.m */; };
74DC3DEAB0FEBADD196F2096 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A29981AD0EE6FDD0623D148 /* libPods.a */; };
C3FDCD671AC57B350053FDC7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FDCD661AC57B350053FDC7 /* main.m */; };
C3FDCD6A1AC57B350053FDC7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FDCD691AC57B350053FDC7 /* AppDelegate.m */; };
C3FDCD701AC57B350053FDC7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3FDCD6E1AC57B350053FDC7 /* Main.storyboard */; };
C3FDCD751AC57B350053FDC7 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3FDCD731AC57B350053FDC7 /* LaunchScreen.xib */; };
C3FDCD8F1AC57C2B0053FDC7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FDCD8C1AC57C2B0053FDC7 /* ViewController.m */; };
C3FDCD901AC57C2B0053FDC7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3FDCD8E1AC57C2B0053FDC7 /* Images.xcassets */; };
C3FDCD921AC57C710053FDC7 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3FDCD911AC57C710053FDC7 /* MapKit.framework */; };
C3FDCDA11AC581DE0053FDC7 /* DBMapSelectorOverlay.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FDCDA01AC581DE0053FDC7 /* DBMapSelectorOverlay.m */; };
C3FDCDA41AC5830E0053FDC7 /* DBMapSelectorOverlayRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FDCDA31AC5830E0053FDC7 /* DBMapSelectorOverlayRenderer.m */; };
C3FDCDA91AC6A2060053FDC7 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3FDCDA81AC6A2060053FDC7 /* CoreLocation.framework */; };
C3FDCDAC1AC6EF450053FDC7 /* DBMapSelectorGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FDCDAB1AC6EF450053FDC7 /* DBMapSelectorGestureRecognizer.m */; };
F7DDE3211AD7AE0D00A67502 /* DBMapSelectorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DDE3201AD7AE0D00A67502 /* DBMapSelectorManager.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
A40D268A1AE2967B00A511E0 /* DBMapSelectorAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBMapSelectorAnnotation.h; sourceTree = "<group>"; };
A40D268B1AE2967B00A511E0 /* DBMapSelectorAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBMapSelectorAnnotation.m; sourceTree = "<group>"; };
161088D68893F60CE0097D3E /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
4A29981AD0EE6FDD0623D148 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
9178E1D3B6FBEE2040B6FD31 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
C3FDCD611AC57B350053FDC7 /* DBMapSelectorViewControllerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DBMapSelectorViewControllerExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
C3FDCD651AC57B350053FDC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C3FDCD661AC57B350053FDC7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
Expand All @@ -36,15 +33,7 @@
C3FDCD8C1AC57C2B0053FDC7 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
C3FDCD8E1AC57C2B0053FDC7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
C3FDCD911AC57C710053FDC7 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
C3FDCD9F1AC581DE0053FDC7 /* DBMapSelectorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBMapSelectorOverlay.h; sourceTree = "<group>"; };
C3FDCDA01AC581DE0053FDC7 /* DBMapSelectorOverlay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBMapSelectorOverlay.m; sourceTree = "<group>"; };
C3FDCDA21AC5830E0053FDC7 /* DBMapSelectorOverlayRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBMapSelectorOverlayRenderer.h; sourceTree = "<group>"; };
C3FDCDA31AC5830E0053FDC7 /* DBMapSelectorOverlayRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBMapSelectorOverlayRenderer.m; sourceTree = "<group>"; };
C3FDCDA81AC6A2060053FDC7 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
C3FDCDAA1AC6EF450053FDC7 /* DBMapSelectorGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DBMapSelectorGestureRecognizer.h; path = ../../Source/DBMapSelectorGestureRecognizer.h; sourceTree = "<group>"; };
C3FDCDAB1AC6EF450053FDC7 /* DBMapSelectorGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DBMapSelectorGestureRecognizer.m; path = ../../Source/DBMapSelectorGestureRecognizer.m; sourceTree = "<group>"; };
F7DDE31F1AD7AE0D00A67502 /* DBMapSelectorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DBMapSelectorManager.h; path = ../../Source/DBMapSelectorManager.h; sourceTree = "<group>"; };
F7DDE3201AD7AE0D00A67502 /* DBMapSelectorManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DBMapSelectorManager.m; path = ../../Source/DBMapSelectorManager.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -54,20 +43,28 @@
files = (
C3FDCDA91AC6A2060053FDC7 /* CoreLocation.framework in Frameworks */,
C3FDCD921AC57C710053FDC7 /* MapKit.framework in Frameworks */,
74DC3DEAB0FEBADD196F2096 /* libPods.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
A40D26891AE2967B00A511E0 /* MapSelectorAnnotation */ = {
01AE93ED703B3F7355EAE1C9 /* Pods */ = {
isa = PBXGroup;
children = (
A40D268A1AE2967B00A511E0 /* DBMapSelectorAnnotation.h */,
A40D268B1AE2967B00A511E0 /* DBMapSelectorAnnotation.m */,
161088D68893F60CE0097D3E /* Pods.debug.xcconfig */,
9178E1D3B6FBEE2040B6FD31 /* Pods.release.xcconfig */,
);
name = MapSelectorAnnotation;
path = ../../Source/MapSelectorAnnotation;
name = Pods;
sourceTree = "<group>";
};
357987647ED8BC61E3B4445C /* Frameworks */ = {
isa = PBXGroup;
children = (
4A29981AD0EE6FDD0623D148 /* libPods.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
C3FDCD581AC57B350053FDC7 = {
Expand All @@ -79,6 +76,8 @@
C3FDCD8A1AC57C2B0053FDC7 /* Classes */,
C3FDCD8D1AC57C2B0053FDC7 /* Resources */,
C3FDCD621AC57B350053FDC7 /* Products */,
01AE93ED703B3F7355EAE1C9 /* Pods */,
357987647ED8BC61E3B4445C /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -113,7 +112,6 @@
C3FDCD8A1AC57C2B0053FDC7 /* Classes */ = {
isa = PBXGroup;
children = (
C3FDCD931AC57C860053FDC7 /* DBMapSelectorViewController */,
C3FDCD6E1AC57B350053FDC7 /* Main.storyboard */,
C3FDCD8B1AC57C2B0053FDC7 /* ViewController.h */,
C3FDCD8C1AC57C2B0053FDC7 /* ViewController.m */,
Expand All @@ -129,41 +127,18 @@
path = Resources;
sourceTree = "<group>";
};
C3FDCD931AC57C860053FDC7 /* DBMapSelectorViewController */ = {
isa = PBXGroup;
children = (
F7DDE31F1AD7AE0D00A67502 /* DBMapSelectorManager.h */,
F7DDE3201AD7AE0D00A67502 /* DBMapSelectorManager.m */,
C3FDCDAA1AC6EF450053FDC7 /* DBMapSelectorGestureRecognizer.h */,
C3FDCDAB1AC6EF450053FDC7 /* DBMapSelectorGestureRecognizer.m */,
A40D26891AE2967B00A511E0 /* MapSelectorAnnotation */,
C3FDCD9B1AC5805B0053FDC7 /* MapSelectorOverlay */,
);
name = DBMapSelectorViewController;
sourceTree = "<group>";
};
C3FDCD9B1AC5805B0053FDC7 /* MapSelectorOverlay */ = {
isa = PBXGroup;
children = (
C3FDCD9F1AC581DE0053FDC7 /* DBMapSelectorOverlay.h */,
C3FDCDA01AC581DE0053FDC7 /* DBMapSelectorOverlay.m */,
C3FDCDA21AC5830E0053FDC7 /* DBMapSelectorOverlayRenderer.h */,
C3FDCDA31AC5830E0053FDC7 /* DBMapSelectorOverlayRenderer.m */,
);
name = MapSelectorOverlay;
path = ../../Source/MapSelectorOverlay;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
C3FDCD601AC57B350053FDC7 /* DBMapSelectorViewControllerExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = C3FDCD841AC57B350053FDC7 /* Build configuration list for PBXNativeTarget "DBMapSelectorViewControllerExample" */;
buildPhases = (
4FCCA57F166099BBE44DD436 /* Check Pods Manifest.lock */,
C3FDCD5D1AC57B350053FDC7 /* Sources */,
C3FDCD5E1AC57B350053FDC7 /* Frameworks */,
C3FDCD5F1AC57B350053FDC7 /* Resources */,
59994EE9BAFA4F27F2DB8C93 /* Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -219,18 +194,46 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
4FCCA57F166099BBE44DD436 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
59994EE9BAFA4F27F2DB8C93 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
C3FDCD5D1AC57B350053FDC7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F7DDE3211AD7AE0D00A67502 /* DBMapSelectorManager.m in Sources */,
C3FDCD8F1AC57C2B0053FDC7 /* ViewController.m in Sources */,
C3FDCDA41AC5830E0053FDC7 /* DBMapSelectorOverlayRenderer.m in Sources */,
C3FDCDA11AC581DE0053FDC7 /* DBMapSelectorOverlay.m in Sources */,
A40D268C1AE2967B00A511E0 /* DBMapSelectorAnnotation.m in Sources */,
C3FDCD6A1AC57B350053FDC7 /* AppDelegate.m in Sources */,
C3FDCDAC1AC6EF450053FDC7 /* DBMapSelectorGestureRecognizer.m in Sources */,
C3FDCD671AC57B350053FDC7 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -338,6 +341,7 @@
};
C3FDCD851AC57B350053FDC7 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 161088D68893F60CE0097D3E /* Pods.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
Expand All @@ -349,6 +353,7 @@
};
C3FDCD861AC57B350053FDC7 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9178E1D3B6FBEE2040B6FD31 /* Pods.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '6.0'

pod 'DBMapSelectorViewController', path: '../'
14 changes: 14 additions & 0 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
PODS:
- DBMapSelectorViewController (1.2.1)

DEPENDENCIES:
- DBMapSelectorViewController (from `../`)

EXTERNAL SOURCES:
DBMapSelectorViewController:
:path: "../"

SPEC CHECKSUMS:
DBMapSelectorViewController: b4b38dcd1ed10eba7b8b7a94d4376dd35bdbfce6

COCOAPODS: 0.37.2
34 changes: 34 additions & 0 deletions Source/DBMapSelectorManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@ typedef NS_ENUM(NSInteger, DBMapSelectorEditingType) {

@end

@protocol DBMapSelectorManagerDataSource <NSObject>

@optional
- (UIView *)mapSelectorManagerLeftCalloutAccessoryView;
- (UIView *)mapSelectorManagerRightCalloutAccessoryView;

@end


@class DBMapSelectorOverlay;
@interface DBMapSelectorManager : NSObject

@property (nonatomic, weak) id<DBMapSelectorManagerDelegate> delegate;
@property (nonatomic, weak) id<DBMapSelectorManagerDataSource> dataSource;
@property (nonatomic, strong, readonly) MKMapView *mapView;

/*!
Expand All @@ -56,6 +66,24 @@ typedef NS_ENUM(NSInteger, DBMapSelectorEditingType) {
/*! @brief Used to specify the maximum selector radius */
@property (nonatomic, assign) CLLocationDistance circleRadiusMax; // default is equal 10000 meter

/*!
@brief Used to specify outer Radis for fill outside
@discussion Total outer radius will be circleRadius plus this
*/
@property (nonatomic, assign) CLLocationDistance circleRadiusFillOutside;

/*!
@brief Used to show a callout
@discussion title shown in the callout
*/
@property (nonatomic, strong) NSString *title;

/*!
@brief Used to show a callout
@discussion subtitle shown in the callout
*/
@property (nonatomic, strong) NSString *subtitle;

/*! @brief Used to hide or show selector */
@property (nonatomic, getter=isHidden) BOOL hidden; // default is NO

Expand All @@ -74,6 +102,12 @@ typedef NS_ENUM(NSInteger, DBMapSelectorEditingType) {
*/
@property (nonatomic, strong) UIColor *strokeColor;

/*!
@brief PinColor
@discussion Color of the dropped Pin
*/
@property (nonatomic) MKPinAnnotationColor pinColor;

/*!
@brief The magnification factor maps region after changing the selector settings
@discussion It is recommended to set a value greater than 1.f
Expand Down
Loading