[ios] Fixed place page context views behavior

This commit is contained in:
Igor Khmurets 2014-03-24 14:53:46 +03:00 committed by Alex Zolotarev
parent 65601a7023
commit 731aabc0f2
2 changed files with 18 additions and 2 deletions

View file

@ -4,6 +4,7 @@
#import "LocationManager.h"
#import "MapsAppDelegate.h"
#import "Framework.h"
#include "../../../map/measurement_utils.hpp"
@implementation LocationImageView
@ -122,13 +123,16 @@
{
double const longitude = MercatorBounds::XToLon(self.pinPoint.x);
double const latitude = MercatorBounds::YToLat(self.pinPoint.y);
NSString * coordinates = [NSString stringWithFormat:@"%@ %@", [self coordinateString:longitude digitsCount:7], [self coordinateString:latitude digitsCount:7]];
NSString * coordinates = [NSString stringWithFormat:@"%@ %@", [self coordinateString:longitude digitsCount:6], [self coordinateString:latitude digitsCount:6]];
[UIPasteboard generalPasteboard].string = coordinates;
}
- (void)copyDegreesLocation:(id)sender
{
[self copyDecimalLocation:nil];
double const latitude = MercatorBounds::YToLat(self.pinPoint.y);
double const longitude = MercatorBounds::XToLon(self.pinPoint.x);
string const coordinates = MeasurementUtils::FormatLatLonAsDMS(latitude, longitude, 3);
[UIPasteboard generalPasteboard].string = [NSString stringWithUTF8String:coordinates.c_str()];
}
- (UILabel *)longitudeValueLabel
@ -202,6 +206,8 @@
self = [super initWithFrame:frame];
self.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
[self addGestureRecognizer:tap];
return self;
}

View file

@ -88,6 +88,10 @@
UILongPressGestureRecognizer * locationPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(locationPress:)];
[self.locationView addGestureRecognizer:locationPress];
UITapGestureRecognizer * locationTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideMenuTap:)];
[self.locationView addGestureRecognizer:locationTap];
UITapGestureRecognizer * addressTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideMenuTap:)];
[self.addressLabel addGestureRecognizer:addressTap];
UILongPressGestureRecognizer * titlePress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(labelPress:)];
[self.titleLabel addGestureRecognizer:titlePress];
@ -242,12 +246,18 @@
- (void)tap:(UITapGestureRecognizer *)sender
{
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES];
if (self.state == PlacePageStateBitShown)
[self setState:PlacePageStateOpened animated:YES];
else if (self.state == PlacePageStateOpened)
[self setState:PlacePageStateBitShown animated:YES];
}
- (void)hideMenuTap:(UITapGestureRecognizer *)sender
{
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES];
}
- (void)pan:(UIPanGestureRecognizer *)sender
{
if (sender.state == UIGestureRecognizerStateBegan)