diff options
author | Илья Гречухин <i.grechuhin@gmail.com> | 2015-12-28 17:33:10 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:04:10 +0300 |
commit | 0714789cb9ac2c76a97e075d8d70ec5a5c7c8873 (patch) | |
tree | e1b3a35fb5b0860b14b305c39626a651c6864c9f /iphone | |
parent | b8e1e702647fe8f77742a588cbe44aa4ad082cc9 (diff) |
[ios] Refactored place page.
Diffstat (limited to 'iphone')
-rw-r--r-- | iphone/Maps/Classes/MWMBasePlacePageView.h | 2 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMBasePlacePageView.mm | 62 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePage.h | 5 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePage.mm | 15 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageButtonCell.mm | 3 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageEntity.mm | 45 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageInfoCell.mm | 38 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageViewManager.h | 3 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageViewManager.mm | 29 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMiPadPlacePage.mm | 13 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm | 19 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm | 12 |
12 files changed, 173 insertions, 73 deletions
diff --git a/iphone/Maps/Classes/MWMBasePlacePageView.h b/iphone/Maps/Classes/MWMBasePlacePageView.h index 9f3d0e61e4..019c86691e 100644 --- a/iphone/Maps/Classes/MWMBasePlacePageView.h +++ b/iphone/Maps/Classes/MWMBasePlacePageView.h @@ -1,5 +1,3 @@ -#import <UIKit/UIKit.h> - @class MWMPlacePageEntity, MWMDirectionView; @interface MWMBasePlacePageView : UIView diff --git a/iphone/Maps/Classes/MWMBasePlacePageView.mm b/iphone/Maps/Classes/MWMBasePlacePageView.mm index e37c564e85..2c8deda5f7 100644 --- a/iphone/Maps/Classes/MWMBasePlacePageView.mm +++ b/iphone/Maps/Classes/MWMBasePlacePageView.mm @@ -5,6 +5,7 @@ #import "MWMPlacePageButtonCell.h" #import "MWMPlacePageEntity.h" #import "MWMPlacePageInfoCell.h" +#import "MWMPlacePageOpeningHoursCell.h" #import "MWMPlacePageTypeDescription.h" #import "MWMPlacePageViewManager.h" #import "Statistics.h" @@ -13,6 +14,7 @@ static NSString * const kPlacePageLinkCellIdentifier = @"PlacePageLinkCell"; static NSString * const kPlacePageInfoCellIdentifier = @"PlacePageInfoCell"; static NSString * const kPlacePageBookmarkCellIdentifier = @"PlacePageBookmarkCell"; static NSString * const kPlacePageButtonCellIdentifier = @"MWMPlacePageButtonCell"; +static NSString * const kPlacePageOpeningHoursCellIdentifier = @"MWMPlacePageOpeningHoursCell"; static CGFloat const kPlacePageTitleKoefficient = 0.63; static CGFloat const kLeftOffset = 16.; @@ -21,11 +23,14 @@ static CGFloat const kOffsetFromTitleToDistance = 12.; static CGFloat const kOffsetFromDistanceToArrow = 8.; extern CGFloat const kBasePlacePageViewTitleBottomOffset = 2.; -@interface MWMBasePlacePageView () +@interface MWMBasePlacePageView () <MWMPlacePageOpeningHoursCellProtocol> @property (weak, nonatomic) MWMPlacePageEntity * entity; @property (weak, nonatomic) IBOutlet MWMPlacePage * ownerPlacePage; @property (nonatomic) MWMPlacePageBookmarkCell * bookmarkSizingCell; +@property (nonatomic) MWMPlacePageOpeningHoursCell * openingHoursSizingCell; + +@property (nonatomic, readwrite) BOOL openingHoursCellExpanded; @end @@ -49,6 +54,8 @@ extern CGFloat const kBasePlacePageViewTitleBottomOffset = 2.; forCellReuseIdentifier:kPlacePageBookmarkCellIdentifier]; [self.featureTable registerNib:[UINib nibWithNibName:kPlacePageButtonCellIdentifier bundle:nil] forCellReuseIdentifier:kPlacePageButtonCellIdentifier]; + [self.featureTable registerNib:[UINib nibWithNibName:kPlacePageOpeningHoursCellIdentifier bundle:nil] + forCellReuseIdentifier:kPlacePageOpeningHoursCellIdentifier]; } - (void)configureWithEntity:(MWMPlacePageEntity *)entity @@ -211,6 +218,32 @@ extern CGFloat const kBasePlacePageViewTitleBottomOffset = 2.; [self setNeedsLayout]; } +#pragma mark - MWMPlacePageOpeningHoursCellProtocol + +- (void)setOpeningHoursCellExpanded:(BOOL)openingHoursCellExpanded forCell:(UITableViewCell *)cell +{ + _openingHoursCellExpanded = openingHoursCellExpanded; + UITableView * tv = self.featureTable; + NSIndexPath * indexPath = [tv indexPathForCell:cell]; + [CATransaction begin]; + [tv beginUpdates]; + [CATransaction setCompletionBlock:^ + { + [self setNeedsLayout]; + dispatch_async(dispatch_get_main_queue(), ^{ [self.ownerPlacePage refresh]; }); + }]; + [tv reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; + [tv endUpdates]; + [CATransaction commit]; +} + +- (void)editPlaceTime +{ + [self.ownerPlacePage editPlaceTime]; +} + +#pragma mark - Properties + - (MWMPlacePageBookmarkCell *)bookmarkSizingCell { if (!_bookmarkSizingCell) @@ -220,6 +253,16 @@ extern CGFloat const kBasePlacePageViewTitleBottomOffset = 2.; return _bookmarkSizingCell; } +- (MWMPlacePageOpeningHoursCell *)openingHoursSizingCell +{ + if (!_openingHoursSizingCell) + _openingHoursSizingCell = + [[[NSBundle mainBundle] loadNibNamed:kPlacePageOpeningHoursCellIdentifier + owner:nil + options:nil] firstObject]; + return _openingHoursSizingCell; +} + @end @implementation MWMBasePlacePageView (UITableView) @@ -232,8 +275,13 @@ extern CGFloat const kBasePlacePageViewTitleBottomOffset = 2.; if (currentType == MWMPlacePageMetadataTypeBookmark) { [self.bookmarkSizingCell config:self.ownerPlacePage forHeight:YES]; - CGFloat height = self.bookmarkSizingCell.cellHeight; - return height; + return self.bookmarkSizingCell.cellHeight; + } + else if (currentType == MWMPlacePageMetadataTypeOpenHours) + { + [self.openingHoursSizingCell configWithInfo:self.entity.metadataValues[indexPath.row] + delegate:self]; + return self.openingHoursSizingCell.cellHeight; } else if (currentType == MWMPlacePageMetadataTypeEditButton) { @@ -268,6 +316,14 @@ extern CGFloat const kBasePlacePageViewTitleBottomOffset = 2.; [cell config:self.ownerPlacePage forHeight:NO]; return cell; } + else if (currentType == MWMPlacePageMetadataTypeOpenHours) + { + MWMPlacePageOpeningHoursCell * cell = (MWMPlacePageOpeningHoursCell *) + [tableView dequeueReusableCellWithIdentifier:kPlacePageOpeningHoursCellIdentifier]; + [cell configWithInfo:self.entity.metadataValues[indexPath.row] + delegate:self]; + return cell; + } else if (currentType == MWMPlacePageMetadataTypeEditButton) { MWMPlacePageButtonCell * cell = (MWMPlacePageButtonCell *)[tableView dequeueReusableCellWithIdentifier:kPlacePageButtonCellIdentifier]; diff --git a/iphone/Maps/Classes/MWMPlacePage.h b/iphone/Maps/Classes/MWMPlacePage.h index ddc0a8f9b7..c4c7763f76 100644 --- a/iphone/Maps/Classes/MWMPlacePage.h +++ b/iphone/Maps/Classes/MWMPlacePage.h @@ -27,7 +27,8 @@ - (void)changeBookmarkColor; - (void)changeBookmarkCategory; - (void)changeBookmarkDescription; -- (void)editPlace; +- (void)editPlaceTime; +- (void)login; - (void)share; - (void)route; - (void)reloadBookmark; @@ -45,6 +46,8 @@ - (void)keyboardWillShow:(NSNotification *)aNotification; - (void)keyboardWillHide; +- (void)refresh; + - (instancetype)init __attribute__((unavailable("call initWithManager: instead"))); @end diff --git a/iphone/Maps/Classes/MWMPlacePage.mm b/iphone/Maps/Classes/MWMPlacePage.mm index b16fd545e7..d1c11354a8 100644 --- a/iphone/Maps/Classes/MWMPlacePage.mm +++ b/iphone/Maps/Classes/MWMPlacePage.mm @@ -129,9 +129,9 @@ static NSString * const kPlacePageViewCenterKeyPath = @"center"; [self.manager removeBookmark]; } -- (void)editPlace +- (void)editPlaceTime { - [self.manager editPlace]; + [self.manager editPlaceTime]; } - (void)share @@ -199,7 +199,7 @@ static NSString * const kPlacePageViewCenterKeyPath = @"center"; - (void)willStartEditingBookmarkTitle { [[Statistics instance] logEvent:kStatEventName(kStatPlacePage, kStatRename)]; -// This method should be ovverriden. +// This method should be overriden. } - (void)willFinishEditingBookmarkTitle:(NSString *)title @@ -210,12 +210,17 @@ static NSString * const kPlacePageViewCenterKeyPath = @"center"; - (IBAction)didTap:(UITapGestureRecognizer *)sender { -// This method should be ovverriden if you want to process custom tap. +// This method should be overriden if you want to process custom tap. } - (IBAction)didPan:(UIPanGestureRecognizer *)sender { - // This method should be ovverriden if you want to process custom pan. + // This method should be overriden if you want to process custom pan. +} + +- (void)refresh +{ + // This method should be overriden. } #pragma mark - Properties diff --git a/iphone/Maps/Classes/MWMPlacePageButtonCell.mm b/iphone/Maps/Classes/MWMPlacePageButtonCell.mm index d6373b7727..a6c5744e5f 100644 --- a/iphone/Maps/Classes/MWMPlacePageButtonCell.mm +++ b/iphone/Maps/Classes/MWMPlacePageButtonCell.mm @@ -1,6 +1,6 @@ +#import "MWMPlacePage.h" #import "MWMPlacePageButtonCell.h" #import "Statistics.h" -#import "MWMPlacePage.h" @interface MWMPlacePageButtonCell () @@ -23,7 +23,6 @@ - (IBAction)editPlaceButtonTouchUpIndide { [[Statistics instance] logEvent:kStatEventName(kStatPlacePage, kStatEdit)]; - [self.placePage editPlace]; } @end diff --git a/iphone/Maps/Classes/MWMPlacePageEntity.mm b/iphone/Maps/Classes/MWMPlacePageEntity.mm index 09af76c547..203ab29e0d 100644 --- a/iphone/Maps/Classes/MWMPlacePageEntity.mm +++ b/iphone/Maps/Classes/MWMPlacePageEntity.mm @@ -3,9 +3,27 @@ #import "MapViewController.h" #include "platform/measurement_utils.hpp" -extern NSArray * const kBookmarkColorsVariant = @[@"placemark-red", @"placemark-yellow", @"placemark-blue", @"placemark-green", @"placemark-purple", @"placemark-orange", @"placemark-brown", @"placemark-pink"]; +extern NSArray * const kBookmarkColorsVariant = @[ + @"placemark-red", + @"placemark-yellow", + @"placemark-blue", + @"placemark-green", + @"placemark-purple", + @"placemark-orange", + @"placemark-brown", + @"placemark-pink" +]; extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; -static NSArray * const kPatternTypesArray = @[@(MWMPlacePageMetadataTypePostcode), @(MWMPlacePageMetadataTypePhoneNumber), @(MWMPlacePageMetadataTypeWebsite), @(MWMPlacePageMetadataTypeURL), @(MWMPlacePageMetadataTypeEmail), @(MWMPlacePageMetadataTypeOpenHours), @(MWMPlacePageMetadataTypeWiFi), @(MWMPlacePageMetadataTypeCoordinate)]; +static NSArray * const kPatternTypesArray = @[ + @(MWMPlacePageMetadataTypePostcode), + @(MWMPlacePageMetadataTypePhoneNumber), + @(MWMPlacePageMetadataTypeWebsite), + @(MWMPlacePageMetadataTypeURL), + @(MWMPlacePageMetadataTypeEmail), + @(MWMPlacePageMetadataTypeOpenHours), + @(MWMPlacePageMetadataTypeWiFi), + @(MWMPlacePageMetadataTypeCoordinate) +]; using feature::Metadata; @@ -184,9 +202,7 @@ using feature::Metadata; case Metadata::FMD_INTERNET: { NSString * v; - if (type == Metadata::EType::FMD_OPEN_HOURS) - v = [self formattedOpenHoursFromString:metadata.Get(type)]; - else if (type == Metadata::FMD_INTERNET) + if (type == Metadata::FMD_INTERNET) v = L(@"WiFi_available"); else v = @(metadata.Get(type).c_str()); @@ -344,23 +360,4 @@ using feature::Metadata; category->SaveToKMLFile(); } -#pragma mark - Open hours string formatter - -- (NSString *)formattedOpenHoursFromString:(string const &)s -{ -//TODO (Vlad): Not the best solution, but this function is temporary and will be replaced in future. - NSMutableString * r = [NSMutableString stringWithUTF8String:s.c_str()]; - [r replaceOccurrencesOfString:@"," withString:@", " options:NSCaseInsensitiveSearch range:NSMakeRange(0, r.length)]; - while (YES) - { - NSRange const range = [r rangeOfString:@" "]; - if (range.location == NSNotFound) - break; - [r replaceCharactersInRange:range withString:@" "]; - } - [r replaceOccurrencesOfString:@"; " withString:@"\n" options:NSCaseInsensitiveSearch range:NSMakeRange(0, r.length)]; - [r replaceOccurrencesOfString:@";" withString:@"\n" options:NSCaseInsensitiveSearch range:NSMakeRange(0, r.length)]; - return r.copy; -} - @end diff --git a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm index 7899c61705..08a48463a2 100644 --- a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm +++ b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm @@ -22,9 +22,19 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey; @implementation MWMPlacePageInfoCell +- (void)awakeFromNib +{ + [super awakeFromNib]; + if ([self.textContainer isKindOfClass:[UITextView class]]) + { + CGFloat const topInset = 12.0; + [self.textContainer setTextContainerInset:{topInset, 0, 0, 0}]; + } +} + - (void)configureWithType:(MWMPlacePageMetadataType)type info:(NSString *)info; { - NSString * typeName = nil; + NSString * typeName; switch (type) { case MWMPlacePageMetadataTypeURL: @@ -43,25 +53,27 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey; case MWMPlacePageMetadataTypePostcode: typeName = @"postcode"; break; - case MWMPlacePageMetadataTypeOpenHours: - typeName = @"open_hours"; - break; case MWMPlacePageMetadataTypeWiFi: typeName = @"wifi"; break; case MWMPlacePageMetadataTypeBookmark: case MWMPlacePageMetadataTypeEditButton: + case MWMPlacePageMetadataTypeOpenHours: NSAssert(false, @"Incorrect type!"); break; } - - UIImage * image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%@", @"ic_placepage_", typeName]]; + + UIImage * image = + [UIImage imageNamed:[NSString stringWithFormat:@"%@%@", @"ic_placepage_", typeName]]; self.type = type; self.icon.image = image; if ([self.textContainer isKindOfClass:[UITextView class]]) { - [self.textContainer setAttributedText:[[NSAttributedString alloc] initWithString:info attributes:@{NSFontAttributeName : [UIFont light16]}]]; + [self.textContainer + setAttributedText:[[NSAttributedString alloc] + initWithString:info + attributes:@{NSFontAttributeName : [UIFont regular17]}]]; self.icon.mwm_coloring = MWMImageColoringBlue; } else @@ -70,7 +82,8 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey; self.icon.mwm_coloring = MWMImageColoringBlack; } - UILongPressGestureRecognizer * longTap = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)]; + UILongPressGestureRecognizer * longTap = + [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)]; longTap.minimumPressDuration = 0.3; [self.upperButton addGestureRecognizer:longTap]; } @@ -80,15 +93,6 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey; return YES; } -- (void)layoutSubviews -{ - CGFloat const leftOffset = 16.; - CGFloat const topOffset = 8.; - CGFloat const textOffset= 60.; - self.icon.origin = {leftOffset, topOffset}; - [self.textContainer setMinX:textOffset]; -} - - (IBAction)cellTap { switch (self.type) diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.h b/iphone/Maps/Classes/MWMPlacePageViewManager.h index 56040ba449..ca1463bc35 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.h +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.h @@ -16,6 +16,7 @@ - (instancetype)initWithViewController:(UIViewController *)viewController delegate:(id<MWMPlacePageViewManagerProtocol>)delegate; - (void)showPlacePageWithUserMark:(unique_ptr<UserMarkCopy>)userMark; +- (void)reloadPlacePage; - (void)refreshPlacePage; - (void)refresh; - (BOOL)hasPlacePage; @@ -25,7 +26,7 @@ - (void)routeFrom; - (void)routeTo; - (void)share; -- (void)editPlace; +- (void)editPlaceTime; - (void)addBookmark; - (void)removeBookmark; - (void)apiBack; diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm index 77ea499b07..cd217b722b 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm @@ -3,6 +3,7 @@ #import "MapsAppDelegate.h" #import "MWMActivityViewController.h" #import "MWMAPIBar.h" +#import "MWMAuthorizationCommon.h" #import "MWMBasePlacePageView.h" #import "MWMDirectionView.h" #import "MWMiPadPlacePage.h" @@ -83,10 +84,16 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) NSAssert(userMark, @"userMark cannot be nil"); m_userMark = move(userMark); [[MapsAppDelegate theApp].m_locationManager start:self]; - self.entity = [[MWMPlacePageEntity alloc] initWithUserMark:m_userMark->GetUserMark()]; +// [self.entity enableEditing]; - [self.entity enableEditing]; + [self reloadPlacePage]; +} +- (void)reloadPlacePage +{ + if (!m_userMark) + return; + self.entity = [[MWMPlacePageEntity alloc] initWithUserMark:m_userMark->GetUserMark()]; self.state = MWMPlacePageManagerStateOpen; if (IPAD) [self setPlacePageForiPad]; @@ -277,9 +284,23 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) m_userMark.reset(new UserMarkCopy(bookmark, false)); } -- (void)editPlace +- (void)editPlaceTime { - [self.ownerViewController performSegueWithIdentifier:@"Map2PlacePageEditor" sender:self.entity]; + NSUserDefaults * ud = [NSUserDefaults standardUserDefaults]; + NSString * username = [ud stringForKey:kOSMUsernameKey]; + NSString * password = [ud stringForKey:kOSMPasswordKey]; + if (!username || !password) + { + [[Statistics instance] logEvent:kStatEventName(kStatPlacePage, kStatEditTime) + withParameters:@{kStatValue : kStatAuthorization}]; + [self.ownerViewController performSegueWithIdentifier:@"Map2Login" sender:nil]; + } + else + { + [[Statistics instance] logEvent:kStatEventName(kStatPlacePage, kStatEditTime) + withParameters:@{kStatValue : kStatEdit}]; + [self.ownerViewController performSegueWithIdentifier:@"Map2OpeningHoursEditor" sender:self.entity]; + } } - (void)addBookmark diff --git a/iphone/Maps/Classes/MWMiPadPlacePage.mm b/iphone/Maps/Classes/MWMiPadPlacePage.mm index d5456359f5..7ab6d77254 100644 --- a/iphone/Maps/Classes/MWMiPadPlacePage.mm +++ b/iphone/Maps/Classes/MWMiPadPlacePage.mm @@ -210,18 +210,23 @@ static CGFloat const kKeyboardOffset = 12.; - (void)addBookmark { [super addBookmark]; - [self updatePlacePageLayoutAnimated:YES]; + [self refresh]; } - (void)removeBookmark { [super removeBookmark]; - [self updatePlacePageLayoutAnimated:YES]; + [self refresh]; } - (void)reloadBookmark { [super reloadBookmark]; + [self refresh]; +} + +- (void)refresh +{ [self updatePlacePageLayoutAnimated:YES]; } @@ -316,13 +321,13 @@ static CGFloat const kKeyboardOffset = 12.; - (void)keyboardWillShow:(NSNotification *)aNotification { [super keyboardWillShow:aNotification]; - [self updatePlacePageLayoutAnimated:YES]; + [self refresh]; } - (void)keyboardWillHide { [super keyboardWillHide]; - [self updatePlacePageLayoutAnimated:YES]; + [self refresh]; } - (CGFloat)getAvailableHeight diff --git a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm index 6c1acbc31f..219008b985 100644 --- a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm +++ b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm @@ -33,7 +33,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) [super configure]; self.anchorImageView.backgroundColor = [UIColor white]; self.anchorImageView.image = nil; - [self configureContentInset]; + [self refresh]; [self addPlacePageShadowToView:self.extendedPlacePageView offset:CGSizeMake(2.0, 4.0)]; [self.extendedPlacePageView addSubview:self.actionBar]; [self.manager addSubviews:@[self.extendedPlacePageView] withNavigationController:nil]; @@ -84,18 +84,23 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) - (void)addBookmark { [super addBookmark]; - [self configureContentInset]; + [self refresh]; } - (void)removeBookmark { [super removeBookmark]; - [self configureContentInset]; + [self refresh]; } - (void)reloadBookmark { [super reloadBookmark]; + [self refresh]; +} + +- (void)refresh +{ [self configureContentInset]; } @@ -136,9 +141,9 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) { [super willStartEditingBookmarkTitle]; CGFloat const statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; - MWMBasePlacePageView const * basePlacePageView = self.basePlacePageView; - UITableView const * tableView = basePlacePageView.featureTable; - CGFloat const baseViewHeight = basePlacePageView.height; + MWMBasePlacePageView * basePPV = self.basePlacePageView; + UITableView const * tableView = basePPV.featureTable; + CGFloat const baseViewHeight = basePPV.height; CGFloat const tableHeight = tableView.contentSize.height; CGFloat const headerViewHeight = baseViewHeight - tableHeight; CGFloat const titleOriginY = tableHeight - kBookmarkCellHeight - tableView.contentOffset.y; @@ -180,7 +185,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) self.actionBar.frame = {{0, height - actionBarHeight}, {width, actionBarHeight}}; if (self.state == MWMiPhoneLandscapePlacePageStateOpen) [self updateTargetPoint]; - [self configureContentInset]; + [self refresh]; } - (void)setTargetPoint:(CGPoint)targetPoint diff --git a/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm b/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm index 12c395eb63..325acf21b7 100644 --- a/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm +++ b/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm @@ -95,19 +95,24 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState) - (void)reloadBookmark { [super reloadBookmark]; - [self updateTargetPoint]; + [self refresh]; } - (void)updateMyPositionStatus:(NSString *)status { [super updateMyPositionStatus:status]; + [self refresh]; +} + +- (void)refresh +{ [self updateTargetPoint]; } - (void)setState:(MWMiPhonePortraitPlacePageState)state { _state = state; - [self updateTargetPoint]; + [self refresh]; switch (state) { case MWMiPhonePortraitPlacePageStateClosed: @@ -116,6 +121,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState) [self.manager.ownerViewController.view endEditing:YES]; break; case MWMiPhonePortraitPlacePageStatePreview: + self.isHover = NO; [MWMPlacePageNavigationBar remove]; [self.manager.ownerViewController.view endEditing:YES]; break; @@ -299,7 +305,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState) - (void)willFinishEditingBookmarkTitle:(NSString *)title { [super willFinishEditingBookmarkTitle:title]; - [self updateTargetPoint]; + [self refresh]; } - (void)setAnchorImage |