[ios] Fixed bug with place page title after editing.

This commit is contained in:
v.mikhaylenko 2015-06-23 17:21:11 +03:00 committed by Alex Zolotarev
parent 078ea88c16
commit 018fdf190f
6 changed files with 20 additions and 10 deletions

View file

@ -34,7 +34,7 @@
- (void)stopBuildingRoute;
- (void)reloadBookmark;
- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight;
- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight;
- (void)willFinishEditingBookmarkTitle:(NSString *)title;
- (IBAction)didTap:(UITapGestureRecognizer *)sender;

View file

@ -146,9 +146,10 @@ extern NSString * const kAlohalyticsTapEventKey;
// This method should be empty if your target is iPad.
}
- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight
- (void)willFinishEditingBookmarkTitle:(NSString *)title
{
// This method should be empty if your target is iPad.
self.basePlacePageView.titleLabel.text = title;
[self.basePlacePageView layoutSubviews];
}
- (IBAction)didTap:(UITapGestureRecognizer *)sender

View file

@ -41,7 +41,7 @@ extern NSString * const kBookmarkCellWebViewDidFinishLoadContetnNotification = @
name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
selector:@selector(keyboardWillBeHidden)
name:UIKeyboardWillHideNotification object:nil];
}
@ -53,12 +53,10 @@ extern NSString * const kBookmarkCellWebViewDidFinishLoadContetnNotification = @
[self.placePage willStartEditingBookmarkTitle:kbSize.height];
}
- (void)keyboardWillBeHidden:(NSNotification *)aNotification
- (void)keyboardWillBeHidden
{
NSDictionary const * info = [aNotification userInfo];
CGSize const kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
if ([self.title isEditing])
[self.placePage willFinishEditingBookmarkTitle:kbSize.height];
[self.placePage willFinishEditingBookmarkTitle:self.title.text.length > 0 ? self.title.text : self.placePage.manager.entity.title];
}
- (void)textFieldDidEndEditing:(UITextField *)textField

View file

@ -117,6 +117,15 @@ static CGFloat const kTopOffset = 36.;
}];
}
- (void)willFinishEditingBookmarkTitle:(NSString *)title
{
[super willFinishEditingBookmarkTitle:title];
CGFloat const actionBarHeight = self.actionBar.height;
CGFloat const defaultHeight = self.basePlacePageView.height + self.anchorImageView.height + actionBarHeight - 1;
self.actionBar.origin = CGPointMake(0., defaultHeight - actionBarHeight);
self.navigationController.view.height = defaultHeight;
}
- (void)addBookmark
{
[super addBookmark];

View file

@ -129,8 +129,9 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
}];
}
- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight
- (void)willFinishEditingBookmarkTitle:(NSString *)title
{
[super willFinishEditingBookmarkTitle:title];
[UIView animateWithDuration:0.3f animations:^
{
self.basePlacePageView.transform = CGAffineTransformMakeTranslation(0., 0.);

View file

@ -237,8 +237,9 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
self.state = MWMiPhonePortraitPlacePageStateOpen;
}
- (void)willFinishEditingBookmarkTitle:(CGFloat)keyboardHeight
- (void)willFinishEditingBookmarkTitle:(NSString *)title
{
[super willFinishEditingBookmarkTitle:title];
self.keyboardHeight = 0.;
[self updateTargetPoint];
}