diff --git a/iphone/Maps/Bookmarks/BalloonView.h b/iphone/Maps/Bookmarks/BalloonView.h index 28e7fd9136..e96e6f6c7f 100644 --- a/iphone/Maps/Bookmarks/BalloonView.h +++ b/iphone/Maps/Bookmarks/BalloonView.h @@ -24,9 +24,10 @@ @property(nonatomic, retain) NSString * setName; @property(nonatomic, assign, readonly) BOOL isDisplayed; @property(nonatomic, assign) CGPoint globalPosition; +@property(nonatomic, assign) BookmarkAndCategory editedBookmark; - (id) initWithTarget:(id)target andSelector:(SEL)selector; -- (void) showInView:(UIView *)view atPoint:(CGPoint)pt withBookmark:(BookmarkAndCategory)bm; +- (void) showInView:(UIView *)view atPoint:(CGPoint)pt; - (void) updatePosition:(UIView *)view atPoint:(CGPoint)pt; - (void) hide; diff --git a/iphone/Maps/Bookmarks/BalloonView.mm b/iphone/Maps/Bookmarks/BalloonView.mm index 3ffe68b979..64903993b7 100644 --- a/iphone/Maps/Bookmarks/BalloonView.mm +++ b/iphone/Maps/Bookmarks/BalloonView.mm @@ -16,6 +16,7 @@ @synthesize color; @synthesize setName; @synthesize isDisplayed; +@synthesize editedBookmark = m_editedBookmark; + (NSString *) getDefaultSetName { @@ -47,6 +48,8 @@ recognizer.numberOfTouchesRequired = 1; recognizer.delaysTouchesBegan = YES; [m_titleView addGestureRecognizer:recognizer]; + + m_editedBookmark = MakeEmptyBookmarkAndCategory(); } return self; } @@ -77,7 +80,7 @@ UIImage * right = [UIImage imageNamed:@"right"]; UIImage * middle = [UIImage imageNamed:@"middle"]; UIImage * tail = [UIImage imageNamed:@"tail"]; - UIImage * arrow = [UIImage imageNamed:@"arrow"]; + UIImage * arrow = [UIImage imageNamed:(IsValid(m_editedBookmark) ? @"arrow" : @"add")]; // Calculate text width and height UIFont * titleFont = [UIFont boldSystemFontOfSize:[UIFont buttonFontSize]]; @@ -131,15 +134,13 @@ return theImage; } -- (void) showInView:(UIView *)view atPoint:(CGPoint)pt withBookmark:(BookmarkAndCategory)bm +- (void) showInView:(UIView *)view atPoint:(CGPoint)pt { if (isDisplayed) [self hide]; isDisplayed = YES; - m_editedBookmark = bm; - CGFloat const w = self.pinImage.bounds.size.width; CGFloat const h = self.pinImage.bounds.size.height; // Fix point @@ -184,6 +185,7 @@ isDisplayed = NO; [m_titleView removeFromSuperview]; [self.pinImage removeFromSuperview]; + m_editedBookmark = MakeEmptyBookmarkAndCategory(); } } diff --git a/iphone/Maps/Bookmarks/add.png b/iphone/Maps/Bookmarks/add.png new file mode 100644 index 0000000000..3713f1fb19 Binary files /dev/null and b/iphone/Maps/Bookmarks/add.png differ diff --git a/iphone/Maps/Bookmarks/add@2x.png b/iphone/Maps/Bookmarks/add@2x.png new file mode 100644 index 0000000000..e7cf786d98 Binary files /dev/null and b/iphone/Maps/Bookmarks/add@2x.png differ diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 2420f1b4c9..cd844b7595 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -188,11 +188,13 @@ if (bm) { m2::PointD const globalPos = bm->GetOrg(); + // Set it before changing balloon title to display different images in case of creating/editing Bookmark + m_balloonView.editedBookmark = bmAndCat; m_balloonView.globalPosition = CGPointMake(globalPos.x, globalPos.y); m_balloonView.title = [NSString stringWithUTF8String:bm->GetName().c_str()]; m_balloonView.color = [NSString stringWithUTF8String:bm->GetType().c_str()]; m_balloonView.setName = [NSString stringWithUTF8String:cat->GetName().c_str()]; - [m_balloonView showInView:self.view atPoint:[self globalPoint2ViewPoint:m_balloonView.globalPosition] withBookmark:bmAndCat]; + [m_balloonView showInView:self.view atPoint:[self globalPoint2ViewPoint:m_balloonView.globalPosition]]; } } } @@ -206,7 +208,7 @@ m2::PointD const gPivot = f.PtoG(pxPivot); m_balloonView.globalPosition = CGPointMake(gPivot.x, gPivot.y); [self updatePinTexts:addrInfo]; - [m_balloonView showInView:self.view atPoint:CGPointMake(pxPivot.x / scaleFactor, pxPivot.y / scaleFactor) withBookmark:MakeEmptyBookmarkAndCategory()]; + [m_balloonView showInView:self.view atPoint:CGPointMake(pxPivot.x / scaleFactor, pxPivot.y / scaleFactor)]; } else { @@ -217,7 +219,7 @@ // @TODO Refactor point transformation m_balloonView.globalPosition = [self viewPoint2GlobalPoint:point]; [self updatePinTexts:addrInfo]; - [m_balloonView showInView:self.view atPoint:point withBookmark:MakeEmptyBookmarkAndCategory()]; + [m_balloonView showInView:self.view atPoint:point]; } } } @@ -227,7 +229,7 @@ { m_balloonView.globalPosition = CGPointMake(pt.x, pt.y); [self updatePinTexts:info]; - [m_balloonView showInView:self.view atPoint:[self globalPoint2ViewPoint:m_balloonView.globalPosition] withBookmark:MakeEmptyBookmarkAndCategory()]; + [m_balloonView showInView:self.view atPoint:[self globalPoint2ViewPoint:m_balloonView.globalPosition]]; } - (void) onSingleTap:(NSValue *)point diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 481744bbdf..63833558d4 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -95,6 +95,10 @@ FA0660041286168700FEA989 /* Default-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = FA0660021286168700FEA989 /* Default-Landscape.png */; }; FA09E01113F71F6C007E69CA /* SearchVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA09E01013F71F6C007E69CA /* SearchVC.mm */; }; FA0B7E631487747B00CAB3F2 /* GetActiveConnectionType.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA0B7E621487747B00CAB3F2 /* GetActiveConnectionType.mm */; }; + FA140631162A44A5002BC1ED /* add.png in Resources */ = {isa = PBXBuildFile; fileRef = FA14062F162A44A5002BC1ED /* add.png */; }; + FA140632162A44A5002BC1ED /* add.png in Resources */ = {isa = PBXBuildFile; fileRef = FA14062F162A44A5002BC1ED /* add.png */; }; + FA140633162A44A5002BC1ED /* add@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FA140630162A44A5002BC1ED /* add@2x.png */; }; + FA140634162A44A5002BC1ED /* add@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FA140630162A44A5002BC1ED /* add@2x.png */; }; FA1FB8A1147E8CA50052848B /* downloader-highlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = FA1FB89B147E8CA50052848B /* downloader-highlighted.png */; }; FA1FB8A2147E8CA50052848B /* downloader-highlighted@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FA1FB89C147E8CA50052848B /* downloader-highlighted@2x.png */; }; FA1FB8A3147E8CA50052848B /* location-highlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = FA1FB89D147E8CA50052848B /* location-highlighted.png */; }; @@ -1398,6 +1402,8 @@ FA09E00F13F71F6C007E69CA /* SearchVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchVC.h; sourceTree = ""; }; FA09E01013F71F6C007E69CA /* SearchVC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SearchVC.mm; sourceTree = ""; }; FA0B7E621487747B00CAB3F2 /* GetActiveConnectionType.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetActiveConnectionType.mm; sourceTree = ""; }; + FA14062F162A44A5002BC1ED /* add.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = add.png; path = Bookmarks/add.png; sourceTree = SOURCE_ROOT; }; + FA140630162A44A5002BC1ED /* add@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "add@2x.png"; path = "Bookmarks/add@2x.png"; sourceTree = SOURCE_ROOT; }; FA1FB89B147E8CA50052848B /* downloader-highlighted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "downloader-highlighted.png"; sourceTree = ""; }; FA1FB89C147E8CA50052848B /* downloader-highlighted@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "downloader-highlighted@2x.png"; sourceTree = ""; }; FA1FB89D147E8CA50052848B /* location-highlighted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "location-highlighted.png"; sourceTree = ""; }; @@ -2330,6 +2336,8 @@ FA36B8171540466A004560CC /* Images */ = { isa = PBXGroup; children = ( + FA14062F162A44A5002BC1ED /* add.png */, + FA140630162A44A5002BC1ED /* add@2x.png */, FAB2D50C15DAB53F00C706C3 /* arrow.png */, FAB2D50D15DAB53F00C706C3 /* arrow@2x.png */, FAB2D50E15DAB53F00C706C3 /* left.png */, @@ -3602,6 +3610,8 @@ FAB2D51F15DAB53F00C706C3 /* tail@2x.png in Resources */, FA9EFCBF1609E150002D6195 /* Default-568h@2x.png in Resources */, FAAEA7D1161BD26600CCD661 /* synonyms.txt in Resources */, + FA140631162A44A5002BC1ED /* add.png in Resources */, + FA140633162A44A5002BC1ED /* add@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4205,6 +4215,8 @@ FA05460B155C22D4001F4E37 /* placemark-red@2x.png in Resources */, FA9EFCC11609E42B002D6195 /* Default-568h@2x.png in Resources */, FAAEA7D2161BD26600CCD661 /* synonyms.txt in Resources */, + FA140632162A44A5002BC1ED /* add.png in Resources */, + FA140634162A44A5002BC1ED /* add@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; };