diff options
author | Ilya Grechuhin <i.grechuhin@mapswithme.com> | 2015-08-10 11:21:40 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:00:04 +0300 |
commit | 3a9c947779ddf45aefcec2c323d2c806fc433312 (patch) | |
tree | 0046d2dca6ab38819bcf0c040d1cb5b0cad88df8 /iphone | |
parent | 96fd81f9e05f09af3115ff1a0413f15839ca725b (diff) |
[ios] Fixed incorrect bookmark button label.
Diffstat (limited to 'iphone')
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePage.mm | 3 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageActionBar.h | 3 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageActionBar.mm | 18 |
3 files changed, 15 insertions, 9 deletions
diff --git a/iphone/Maps/Classes/MWMPlacePage.mm b/iphone/Maps/Classes/MWMPlacePage.mm index cce642b69f..97aa66e9e3 100644 --- a/iphone/Maps/Classes/MWMPlacePage.mm +++ b/iphone/Maps/Classes/MWMPlacePage.mm @@ -47,8 +47,7 @@ extern NSString * const kAlohalyticsTapEventKey; [self.basePlacePageView configureWithEntity:entity]; MWMPlacePageEntityType type = entity.type; - BOOL const isBookmark = type == MWMPlacePageEntityTypeBookmark; - self.actionBar.bookmarkButton.selected = isBookmark; + self.actionBar.isBookmark = type == MWMPlacePageEntityTypeBookmark; BOOL const isMyPosition = type == MWMPlacePageEntityTypeMyPosition; [self.actionBar configureForMyPosition:isMyPosition]; diff --git a/iphone/Maps/Classes/MWMPlacePageActionBar.h b/iphone/Maps/Classes/MWMPlacePageActionBar.h index 01f0c4635b..46051309bb 100644 --- a/iphone/Maps/Classes/MWMPlacePageActionBar.h +++ b/iphone/Maps/Classes/MWMPlacePageActionBar.h @@ -12,8 +12,7 @@ @interface MWMPlacePageActionBar : UIView -@property (weak, nonatomic) IBOutlet UIButton * bookmarkButton; -@property (weak, nonatomic) IBOutlet UIButton * routeButton; +@property (nonatomic) BOOL isBookmark; + (MWMPlacePageActionBar *)actionBarForPlacePage:(MWMPlacePage *)placePage; - (void)configureForMyPosition:(BOOL)isMyPosition; diff --git a/iphone/Maps/Classes/MWMPlacePageActionBar.mm b/iphone/Maps/Classes/MWMPlacePageActionBar.mm index b249d84c0a..9a475bad44 100644 --- a/iphone/Maps/Classes/MWMPlacePageActionBar.mm +++ b/iphone/Maps/Classes/MWMPlacePageActionBar.mm @@ -25,7 +25,9 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar"; @property (weak, nonatomic) MWMPlacePage * placePage; +@property (weak, nonatomic) IBOutlet UIButton * bookmarkButton; @property (weak, nonatomic) IBOutlet UIButton * shareButton; +@property (weak, nonatomic) IBOutlet UIButton * routeButton; @property (weak, nonatomic) IBOutlet UILabel * routeLabel; @property (weak, nonatomic) IBOutlet UILabel * bookmarkLabel; @property (weak, nonatomic) IBOutlet UILabel * shareLabel; @@ -63,19 +65,16 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar"; - (IBAction)bookmarkTap:(UIButton *)sender { - sender.selected = !sender.selected; + self.isBookmark = !self.isBookmark; NSMutableString * eventName = @"ppBookmarkButtonTap".mutableCopy; - if (sender.selected) + if (self.isBookmark) { [sender.imageView startAnimating]; - self.bookmarkLabel.text = L(@"delete"); [self.placePage addBookmark]; [eventName appendString:@"Add"]; } else { - - self.bookmarkLabel.text = L(@"save"); [self.placePage removeBookmark]; [eventName appendString:@"Delete"]; } @@ -122,4 +121,13 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar"; [self.placePage route]; } +#pragma mark - Properties + +- (void)setIsBookmark:(BOOL)isBookmark +{ + _isBookmark = isBookmark; + self.bookmarkButton.selected = isBookmark; + self.bookmarkLabel.text = L(isBookmark ? @"delete" : @"save"); +} + @end |