diff options
author | v.mikhaylenko <v.mikhaylenko@corp.mail.ru> | 2015-05-25 16:13:04 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:52:39 +0300 |
commit | 279c4e252521359d59d76e533b7cde41a74183e9 (patch) | |
tree | 614a5a8462f69c0b81342d7fbcf19f49cf2e8f18 /iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm | |
parent | 279e4649433bcbc06e888d557f77d7dd8708fa98 (diff) |
[ios] Made place page for iPad. Added big compas view. Added bookmarks edit.
Diffstat (limited to 'iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm')
-rw-r--r-- | iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm index d22af78890..09353ab000 100644 --- a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm +++ b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm @@ -17,6 +17,7 @@ #include "Framework.h" static CGFloat const kMaximumPlacePageWidth = 360.; +extern CGFloat const kBookmarkCellHeight; typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) { @@ -36,42 +37,37 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) - (void)configure { [super configure]; - UIView const * view = self.manager.ownerViewController.view; - if ([view.subviews containsObject:self.extendedPlacePageView] && self.state != MWMiPhoneLandscapePlacePageStateClosed) - return; CGSize const size = UIScreen.mainScreen.bounds.size; CGFloat const height = size.width > size.height ? size.height : size.width; CGFloat const offset = height > kMaximumPlacePageWidth ? kMaximumPlacePageWidth : height; - self.extendedPlacePageView.frame = CGRectMake(-offset, 0, offset, height); + UIView const * view = self.manager.ownerViewController.view; + if ([view.subviews containsObject:self.extendedPlacePageView] && self.state != MWMiPhoneLandscapePlacePageStateClosed) + return; + + self.extendedPlacePageView.frame = CGRectMake(0., 0, offset, height); + + self.anchorImageView.backgroundColor = [UIColor whiteColor]; self.anchorImageView.image = nil; - self.anchorImageView.backgroundColor = self.basePlacePageView.backgroundColor; - self.actionBar = [MWMPlacePageActionBar actionBarForPlacePage:self]; - -#warning TODO (Vlad): Change 35. to computational constant. - self.basePlacePageView.featureTable.contentInset = UIEdgeInsetsMake(0., 0., self.actionBar.height + 35., 0.); - + CGFloat const headerViewHeight = self.basePlacePageView.height - self.basePlacePageView.featureTable.height; + CGFloat const tableContentHeight = self.basePlacePageView.featureTable.contentSize.height; + self.basePlacePageView.featureTable.contentInset = UIEdgeInsetsMake(0., 0., self.actionBar.height+ (tableContentHeight - height - headerViewHeight + self.anchorImageView.height), 0.); [view addSubview:self.extendedPlacePageView]; + self.actionBar.width = offset; self.actionBar.center = CGPointMake(self.actionBar.width / 2., height - self.actionBar.height / 2.); [self.extendedPlacePageView addSubview:self.actionBar]; } - (void)show { - if (self.state != MWMiPhoneLandscapePlacePageStateOpen) - self.state = MWMiPhoneLandscapePlacePageStateOpen; -} - -- (void)dismiss -{ - self.state = MWMiPhoneLandscapePlacePageStateClosed; - [super dismiss]; + self.state = MWMiPhoneLandscapePlacePageStateOpen; } - (void)addBookmark { - [self.basePlacePageView addBookmark]; + [super addBookmark]; + } - (void)setState:(MWMiPhoneLandscapePlacePageState)state @@ -113,7 +109,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) if (sender.state == UIGestureRecognizerStateEnded) { CGPoint velocity = [sender velocityInView:self.extendedPlacePageView.superview]; - velocity.y = 20; + velocity.y = 20.; self.state = velocity.x < 0. ? MWMiPhoneLandscapePlacePageStateClosed : MWMiPhoneLandscapePlacePageStateOpen; [self startAnimatingPlacePage:self initialVelocity:velocity]; if (self.state == MWMiPhoneLandscapePlacePageStateClosed) @@ -125,4 +121,28 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) } } +- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight +{ + CGFloat const statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; + MWMBasePlacePageView const * basePlacePageView = self.basePlacePageView; + UITableView const * tableView = basePlacePageView.featureTable; + CGFloat const baseViewHeight = basePlacePageView.height; + CGFloat const tableHeight = tableView.contentSize.height; + CGFloat const headerViewHeight = baseViewHeight - tableHeight; + CGFloat const titleOriginY = tableHeight - kBookmarkCellHeight - tableView.contentOffset.y; + + [UIView animateWithDuration:0.3f animations:^ + { + self.basePlacePageView.transform = CGAffineTransformMakeTranslation(0., statusBarHeight - headerViewHeight - titleOriginY); + }]; +} + +- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight +{ + [UIView animateWithDuration:0.3f animations:^ + { + self.basePlacePageView.transform = CGAffineTransformMakeTranslation(0., 0.); + }]; +} + @end |