[ios] Update bookmark title when it's name is edited

This commit is contained in:
Alex Zolotarev 2012-08-24 13:31:45 +03:00 committed by Alex Zolotarev
parent 451ea8b4dd
commit de0d2d236a
4 changed files with 23 additions and 1 deletions

View file

@ -28,5 +28,7 @@
- (void) showInView:(UIView *)view atPoint:(CGPoint)pt;
- (void) updatePosition:(UIView *)view atPoint:(CGPoint)pt;
- (void) hide;
// Update baloon image with new title
- (void) updateTitle:(NSString *)newTitle;
@end

View file

@ -185,4 +185,10 @@
self.pinImage.image = [UIImage imageNamed:newColor];
}
- (void) updateTitle:(NSString *)newTitle
{
if (m_titleView != nil)
m_titleView.image = [self createPopupImageWithName:newTitle andAddress:description];
}
@end

View file

@ -73,7 +73,7 @@
{
if (section != 0)
return 0;
return 40;
return 60;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@ -208,6 +208,18 @@
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
if (m_balloon.title != textField.text)
{
if (textField.text.length == 0)
{
m_balloon.title = NSLocalizedString(@"dropped_pin", @"Unknown Dropped Pin title, when name can't be determined");
textField.text = m_balloon.title;
}
else
m_balloon.title = textField.text;
self.navigationController.title = m_balloon.title;
[m_balloon updateTitle:m_balloon.title];
}
return NO;
}
@end

View file

@ -156,6 +156,8 @@
// Already added bookmark was clicked
m2::PointD const globalPos = bm->GetOrg();
m_bookmark.globalPosition = CGPointMake(globalPos.x, globalPos.y);
// Override bookmark name which was set automatically according to the point address in previous line
m_bookmark.title = [NSString stringWithUTF8String:bm->GetName().c_str()];
[m_bookmark showInView:self.view atPoint:[self globalPoint2ViewPoint:m_bookmark.globalPosition]];
}
}