Authored by Justin R. Miller

fixes #119: move resources to bundle for easier installation

... ... @@ -21,9 +21,6 @@
if (self)
{
RMRequireAsset(@"LoadingTile.png");
RMRequireAsset(@"LoadingTileZoom.png");
_contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width * 3, frame.size.height * 3)];
[self addSubview:_contentView];
... ... @@ -47,11 +44,11 @@
{
if (zooming)
{
_contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"LoadingTileZoom.png"]];
_contentView.backgroundColor = [UIColor colorWithPatternImage:[RMMapView resourceImageNamed:@"LoadingTileZoom.png"]];
}
else
{
_contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"LoadingTile.png"]];
_contentView.backgroundColor = [UIColor colorWithPatternImage:[RMMapView resourceImageNamed:@"LoadingTile.png"]];
_contentView.frame = CGRectMake(0, 0, self.frame.size.width * 3, self.frame.size.height * 3);
self.contentSize = _contentView.bounds.size;
... ...
... ... @@ -175,6 +175,8 @@ typedef enum : NSUInteger {
- (void)setFrame:(CGRect)frame;
+ (UIImage *)resourceImageNamed:(NSString *)imageName;
#pragma mark - Movement
/** @name Panning the Map */
... ...
... ... @@ -393,6 +393,17 @@
}
}
+ (UIImage *)resourceImageNamed:(NSString *)imageName
{
NSAssert([[NSBundle mainBundle] pathForResource:@"MapBox" ofType:@"bundle"], @"Resource bundle not found in application.");
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"MapBox" ofType:@"bundle"];
NSBundle *resourcesBundle = [NSBundle bundleWithPath:bundlePath];
NSString *imagePath = [resourcesBundle pathForResource:imageName ofType:nil];
return [UIImage imageWithContentsOfFile:imagePath];
}
- (void)dealloc
{
LogMethod();
... ... @@ -2245,7 +2256,7 @@
{
if (showLogoBug && ! _logoBug)
{
_logoBug = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mapbox.png"]];
_logoBug = [[UIImageView alloc] initWithImage:[RMMapView resourceImageNamed:@"mapbox.png"]];
_logoBug.frame = CGRectMake(8, self.bounds.size.height - _logoBug.bounds.size.height - 4, _logoBug.bounds.size.width, _logoBug.bounds.size.height);
_logoBug.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
... ... @@ -2761,12 +2772,6 @@
if (newShowsUserLocation)
{
RMRequireAsset(@"HeadingAngleSmall.png");
RMRequireAsset(@"TrackingDot.png");
RMRequireAsset(@"TrackingDotHalo.png");
RMRequireAsset(@"TrackingHeading.png");
RMRequireAsset(@"TrackingLocation.png");
if (_delegateHasWillStartLocatingUser)
[_delegate mapViewWillStartLocatingUser:self];
... ... @@ -2935,7 +2940,7 @@
self.userLocation.layer.hidden = YES;
_userHaloTrackingView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TrackingDotHalo"]];
_userHaloTrackingView = [[UIImageView alloc] initWithImage:[RMMapView resourceImageNamed:@"TrackingDotHalo"]];
_userHaloTrackingView.center = CGPointMake(round([self bounds].size.width / 2),
round([self bounds].size.height / 2));
... ... @@ -2950,7 +2955,7 @@
[self insertSubview:_userHaloTrackingView belowSubview:_overlayView];
_userHeadingTrackingView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"HeadingAngleSmall.png"]];
_userHeadingTrackingView = [[UIImageView alloc] initWithImage:[RMMapView resourceImageNamed:@"HeadingAngleSmall.png"]];
_userHeadingTrackingView.frame = CGRectMake((self.bounds.size.width / 2) - (_userHeadingTrackingView.bounds.size.width / 2),
(self.bounds.size.height / 2) - _userHeadingTrackingView.bounds.size.height,
... ... @@ -2968,7 +2973,7 @@
[self insertSubview:_userHeadingTrackingView belowSubview:_overlayView];
_userLocationTrackingView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TrackingDot.png"]];
_userLocationTrackingView = [[UIImageView alloc] initWithImage:[RMMapView resourceImageNamed:@"TrackingDot.png"]];
_userLocationTrackingView.center = CGPointMake(round([self bounds].size.width / 2),
round([self bounds].size.height / 2));
... ... @@ -3087,7 +3092,7 @@
// create image marker
//
_trackingHaloAnnotation.layer = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"TrackingDotHalo.png"]];
_trackingHaloAnnotation.layer = [[RMMarker alloc] initWithUIImage:[RMMapView resourceImageNamed:@"TrackingDotHalo.png"]];
_trackingHaloAnnotation.layer.zPosition = -MAXFLOAT + 1;
_trackingHaloAnnotation.isUserLocationAnnotation = YES;
... ...
... ... @@ -21,7 +21,7 @@
if ( ! (self = [super initWithMapView:aMapView coordinate:aCoordinate andTitle:aTitle]))
return nil;
self.layer = [[[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"TrackingDot.png"]] autorelease];
self.layer = [[[RMMarker alloc] initWithUIImage:[RMMapView resourceImageNamed:@"TrackingDot.png"]] autorelease];
self.layer.zPosition = -MAXFLOAT + 2;
... ...
... ... @@ -74,7 +74,7 @@ typedef enum {
[self.customView addSubview:_segmentedControl];
_buttonImageView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TrackingLocation.png"]] retain];
_buttonImageView = [[[UIImageView alloc] initWithImage:[RMMapView resourceImageNamed:@"TrackingLocation.png"]] retain];
_buttonImageView.contentMode = UIViewContentModeCenter;
_buttonImageView.frame = CGRectMake(0, 0, 32, 32);
_buttonImageView.center = self.customView.center;
... ... @@ -192,7 +192,7 @@ typedef enum {
}
completion:^(BOOL finished)
{
_buttonImageView.image = [UIImage imageNamed:(_mapView.userTrackingMode == RMUserTrackingModeFollowWithHeading ? @"TrackingHeading.png" : @"TrackingLocation.png")];
_buttonImageView.image = [RMMapView resourceImageNamed:(_mapView.userTrackingMode == RMUserTrackingModeFollowWithHeading ? @"TrackingHeading.png" : @"TrackingLocation.png")];
_buttonImageView.hidden = NO;
[_activityView stopAnimating];
... ...
... ... @@ -109,6 +109,20 @@
DD6380DE152E72880074E66E /* RMMapBoxSource.m in Sources */ = {isa = PBXBuildFile; fileRef = DD6380DC152E72880074E66E /* RMMapBoxSource.m */; };
DD5FA1EB15E2B020004EB6C5 /* RMLoadingTileView.h in Headers */ = {isa = PBXBuildFile; fileRef = DD5FA1E915E2B020004EB6C5 /* RMLoadingTileView.h */; };
DD5FA1EC15E2B020004EB6C5 /* RMLoadingTileView.m in Sources */ = {isa = PBXBuildFile; fileRef = DD5FA1EA15E2B020004EB6C5 /* RMLoadingTileView.m */; };
DD6A83811644A26E0097F31F /* mapbox.png in Resources */ = {isa = PBXBuildFile; fileRef = DDC006CF1601580F00E42892 /* mapbox.png */; };
DD6A83821644A26E0097F31F /* mapbox@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DDC006D01601580F00E42892 /* mapbox@2x.png */; };
DD6A83831644A26E0097F31F /* HeadingAngleSmall.png in Resources */ = {isa = PBXBuildFile; fileRef = DD8FD7631559EE120044D96F /* HeadingAngleSmall.png */; };
DD6A83841644A26E0097F31F /* HeadingAngleSmall@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD8FD7641559EE120044D96F /* HeadingAngleSmall@2x.png */; };
DD6A83851644A26E0097F31F /* LoadingTile.png in Resources */ = {isa = PBXBuildFile; fileRef = DD49B8A915E2CE4E0055CCEE /* LoadingTile.png */; };
DD6A83861644A26E0097F31F /* LoadingTileZoom.png in Resources */ = {isa = PBXBuildFile; fileRef = DD49B8A815E2CE4E0055CCEE /* LoadingTileZoom.png */; };
DD6A83871644A26E0097F31F /* TrackingDot.png in Resources */ = {isa = PBXBuildFile; fileRef = DD8FD7651559EE120044D96F /* TrackingDot.png */; };
DD6A83881644A26E0097F31F /* TrackingDot@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD8FD7661559EE120044D96F /* TrackingDot@2x.png */; };
DD6A83891644A26E0097F31F /* TrackingDotHalo.png in Resources */ = {isa = PBXBuildFile; fileRef = DD8FD76C1559EE120044D96F /* TrackingDotHalo.png */; };
DD6A838A1644A26E0097F31F /* TrackingDotHalo@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD8FD7691559EE120044D96F /* TrackingDotHalo@2x.png */; };
DD6A838B1644A26E0097F31F /* TrackingHeading.png in Resources */ = {isa = PBXBuildFile; fileRef = DDA6B8C2155CAB9A003DB5D8 /* TrackingHeading.png */; };
DD6A838C1644A26E0097F31F /* TrackingHeading@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DDA6B8C3155CAB9A003DB5D8 /* TrackingHeading@2x.png */; };
DD6A838D1644A26E0097F31F /* TrackingLocation.png in Resources */ = {isa = PBXBuildFile; fileRef = DDA6B8C0155CAB9A003DB5D8 /* TrackingLocation.png */; };
DD6A838E1644A26E0097F31F /* TrackingLocation@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DDA6B8C1155CAB9A003DB5D8 /* TrackingLocation@2x.png */; };
DD8CDB4A14E0507100B73EB9 /* RMMapQuestOSMSource.h in Headers */ = {isa = PBXBuildFile; fileRef = DD8CDB4814E0507100B73EB9 /* RMMapQuestOSMSource.h */; };
DD8CDB4B14E0507100B73EB9 /* RMMapQuestOSMSource.m in Sources */ = {isa = PBXBuildFile; fileRef = DD8CDB4914E0507100B73EB9 /* RMMapQuestOSMSource.m */; };
DD8FD7541559E4A40044D96F /* RMUserLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = DD8FD7521559E4A40044D96F /* RMUserLocation.h */; };
... ... @@ -136,6 +150,13 @@
remoteGlobalIDString = D2AAC07D0554694100DB518D;
remoteInfo = Proj4;
};
DD6A838F1644A2810097F31F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = DD6A83741644A20C0097F31F;
remoteInfo = Resources;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
... ... @@ -244,6 +265,7 @@
DD5A200A15CAD09400FE4157 /* GRMustache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GRMustache.h; path = GRMustache/include/GRMustache.h; sourceTree = "<group>"; };
DD5FA1E915E2B020004EB6C5 /* RMLoadingTileView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMLoadingTileView.h; sourceTree = "<group>"; };
DD5FA1EA15E2B020004EB6C5 /* RMLoadingTileView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMLoadingTileView.m; sourceTree = "<group>"; };
DD6A83751644A20C0097F31F /* MapBox.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MapBox.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
DD8CDB4814E0507100B73EB9 /* RMMapQuestOSMSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMMapQuestOSMSource.h; sourceTree = "<group>"; };
DD8CDB4914E0507100B73EB9 /* RMMapQuestOSMSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RMMapQuestOSMSource.m; sourceTree = "<group>"; };
DD8FD7521559E4A40044D96F /* RMUserLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RMUserLocation.h; sourceTree = "<group>"; };
... ... @@ -333,6 +355,7 @@
isa = PBXGroup;
children = (
17F31EFA1331050A00122B16 /* libMapView.a */,
DD6A83751644A20C0097F31F /* MapBox.bundle */,
);
name = Products;
sourceTree = "<group>";
... ... @@ -646,6 +669,7 @@
buildRules = (
);
dependencies = (
DD6A83901644A2810097F31F /* PBXTargetDependency */,
B8C974140E8A19B2007D16AD /* PBXTargetDependency */,
);
name = MapView;
... ... @@ -653,6 +677,23 @@
productReference = 17F31EFA1331050A00122B16 /* libMapView.a */;
productType = "com.apple.product-type.library.static";
};
DD6A83741644A20C0097F31F /* Resources */ = {
isa = PBXNativeTarget;
buildConfigurationList = DD6A837E1644A20C0097F31F /* Build configuration list for PBXNativeTarget "Resources" */;
buildPhases = (
DD6A83711644A20C0097F31F /* Sources */,
DD6A83721644A20C0097F31F /* Frameworks */,
DD6A83731644A20C0097F31F /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = Resources;
productName = Resources;
productReference = DD6A83751644A20C0097F31F /* MapBox.bundle */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
... ... @@ -670,6 +711,7 @@
Japanese,
French,
German,
en,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
... ... @@ -682,6 +724,7 @@
projectRoot = "";
targets = (
B8C974130E8A19B2007D16AD /* MapView */,
DD6A83741644A20C0097F31F /* Resources */,
);
};
/* End PBXProject section */
... ... @@ -696,6 +739,30 @@
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
DD6A83731644A20C0097F31F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DD6A83811644A26E0097F31F /* mapbox.png in Resources */,
DD6A83821644A26E0097F31F /* mapbox@2x.png in Resources */,
DD6A83831644A26E0097F31F /* HeadingAngleSmall.png in Resources */,
DD6A83841644A26E0097F31F /* HeadingAngleSmall@2x.png in Resources */,
DD6A83851644A26E0097F31F /* LoadingTile.png in Resources */,
DD6A83861644A26E0097F31F /* LoadingTileZoom.png in Resources */,
DD6A83871644A26E0097F31F /* TrackingDot.png in Resources */,
DD6A83881644A26E0097F31F /* TrackingDot@2x.png in Resources */,
DD6A83891644A26E0097F31F /* TrackingDotHalo.png in Resources */,
DD6A838A1644A26E0097F31F /* TrackingDotHalo@2x.png in Resources */,
DD6A838B1644A26E0097F31F /* TrackingHeading.png in Resources */,
DD6A838C1644A26E0097F31F /* TrackingHeading@2x.png in Resources */,
DD6A838D1644A26E0097F31F /* TrackingLocation.png in Resources */,
DD6A838E1644A26E0097F31F /* TrackingLocation@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
B8C974340E8A19B2007D16AD /* Sources */ = {
isa = PBXSourcesBuildPhase;
... ... @@ -752,6 +819,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
DD6A83711644A20C0097F31F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
... ... @@ -760,6 +834,11 @@
name = Proj4;
targetProxy = B8C974150E8A19B2007D16AD /* PBXContainerItemProxy */;
};
DD6A83901644A2810097F31F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = DD6A83741644A20C0097F31F /* Resources */;
targetProxy = DD6A838F1644A2810097F31F /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
... ... @@ -860,6 +939,56 @@
};
name = Release;
};
DD6A837F1644A20C0097F31F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Resources/Resources-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = MapBox;
WRAPPER_EXTENSION = bundle;
};
name = Debug;
};
DD6A83801644A20C0097F31F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Resources/Resources-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
PRODUCT_NAME = MapBox;
WRAPPER_EXTENSION = bundle;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
... ... @@ -881,6 +1010,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
DD6A837E1644A20C0097F31F /* Build configuration list for PBXNativeTarget "Resources" */ = {
isa = XCConfigurationList;
buildConfigurations = (
DD6A837F1644A20C0097F31F /* Debug */,
DD6A83801644A20C0097F31F /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
... ...
... ... @@ -23,5 +23,3 @@
#define WarnDeprecated()
#define NS_BLOCK_ASSERTIONS 1
#endif
#define RMRequireAsset(asset) NSAssert([[NSBundle mainBundle] pathForResource:[asset stringByReplacingOccurrencesOfString:[@"." stringByAppendingString:[asset pathExtension]] withString:@""] ofType:[asset pathExtension]], @"Unable to find %@ (copy from framework 'Resources' folder)", asset);
... ...