diff options
author | Ilya Grechuhin <i.grechuhin@mapswithme.com> | 2015-09-14 17:52:41 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:05:35 +0300 |
commit | 231e5de63ce16b255fa39d99947210476e2f8aba (patch) | |
tree | 2784559d2ca4afcf652dfe84495d286efd9be6cb /iphone/Maps/Classes/MWMPlacePageViewManager.mm | |
parent | 43e224110313befa5da64d96afa737e7c0c4c218 (diff) |
[ios] Updated search to v2.0.
Diffstat (limited to 'iphone/Maps/Classes/MWMPlacePageViewManager.mm')
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageViewManager.mm | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm index b8e6079610..5b41623f14 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm @@ -18,6 +18,8 @@ #include "Framework.h" +extern NSString * const kBookmarksChangedNotification; + typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) { MWMPlacePageManagerStateClosed, @@ -80,8 +82,21 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) [self configPlacePage]; } +#pragma mark - Layout + - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { + [self rotateToOrientation:orientation]; +} + +- (void)viewWillTransitionToSize:(CGSize)size + withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator +{ + [self rotateToOrientation:size.height > size.width ? UIInterfaceOrientationPortrait : UIInterfaceOrientationLandscapeLeft]; +} + +- (void)rotateToOrientation:(UIInterfaceOrientation)orientation +{ if (!self.placePage) return; @@ -106,6 +121,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) self.entity.category = [[MapsAppDelegate theApp].m_locationManager formattedSpeedAndAltitude:hasSpeed]; } self.placePage.topBound = self.topBound; + self.placePage.leftBound = self.leftBound; self.placePage.parentViewHeight = self.ownerViewController.view.height; [self.placePage configure]; [self refreshPlacePage]; @@ -195,8 +211,8 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) Framework & f = GetFramework(); BookmarkData data = BookmarkData(self.entity.title.UTF8String, f.LastEditedBMType()); size_t const categoryIndex = f.LastEditedBMCategory(); - size_t const bookmarkIndex = f.GetBookmarkManager().AddBookmark(categoryIndex, m_userMark->GetUserMark()->GetOrg(), - data); + size_t const bookmarkIndex = + f.GetBookmarkManager().AddBookmark(categoryIndex, m_userMark->GetUserMark()->GetOrg(), data); self.entity.bac = make_pair(categoryIndex, bookmarkIndex); self.entity.type = MWMPlacePageEntityTypeBookmark; BookmarkCategory const * category = f.GetBmCategory(categoryIndex); @@ -204,6 +220,9 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) m_userMark.reset(new UserMarkCopy(bookmark, false)); f.ActivateUserMark(bookmark); f.Invalidate(); + [NSNotificationCenter.defaultCenter postNotificationName:kBookmarksChangedNotification + object:nil + userInfo:nil]; } - (void)removeBookmark @@ -222,6 +241,9 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) bookmarkCategory->SaveToKMLFile(); } f.Invalidate(); + [NSNotificationCenter.defaultCenter postNotificationName:kBookmarksChangedNotification + object:nil + userInfo:nil]; } - (void)reloadBookmark @@ -309,10 +331,14 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) return self.directionView.superview != nil; } -- (void)setTopBound:(CGFloat)bound +- (void)setTopBound:(CGFloat)topBound +{ + _topBound = self.placePage.topBound = topBound; +} + +- (void)setLeftBound:(CGFloat)leftBound { - _topBound = bound; - self.placePage.topBound = bound; + _leftBound = self.placePage.leftBound = leftBound; } @end |