forked from organicmaps/organicmaps-tmp
[ios] UI fixes
This commit is contained in:
parent
d3014cc96d
commit
908a3e0e35
6 changed files with 49 additions and 26 deletions
|
@ -64,7 +64,7 @@
|
|||
_titleLabel.textAlignment = NSTextAlignmentLeft;
|
||||
_titleLabel.numberOfLines = 0;
|
||||
_titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.textColor = [UIColor blackColor];
|
||||
_titleLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
|
||||
}
|
||||
return _titleLabel;
|
||||
|
|
|
@ -190,7 +190,7 @@
|
|||
_distanceLabel.backgroundColor = [UIColor clearColor];
|
||||
_distanceLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17.5];
|
||||
_distanceLabel.textAlignment = NSTextAlignmentLeft;
|
||||
_distanceLabel.textColor = [UIColor whiteColor];
|
||||
_distanceLabel.textColor = [UIColor blackColor];
|
||||
_distanceLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
|
||||
}
|
||||
return _distanceLabel;
|
||||
|
@ -206,7 +206,7 @@
|
|||
_addressLabel.numberOfLines = 0;
|
||||
_addressLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
||||
_addressLabel.textAlignment = NSTextAlignmentLeft;
|
||||
_addressLabel.textColor = [UIColor whiteColor];
|
||||
_addressLabel.textColor = [UIColor blackColor];
|
||||
_addressLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
|
||||
UILongPressGestureRecognizer * press = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(addressPress:)];
|
||||
[_addressLabel addGestureRecognizer:press];
|
||||
|
@ -222,7 +222,7 @@
|
|||
_coordinatesLabel.backgroundColor = [UIColor clearColor];
|
||||
_coordinatesLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17.5];
|
||||
_coordinatesLabel.textAlignment = NSTextAlignmentLeft;
|
||||
_coordinatesLabel.textColor = [UIColor whiteColor];
|
||||
_coordinatesLabel.textColor = [UIColor blackColor];
|
||||
_coordinatesLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
|
||||
UILongPressGestureRecognizer * press = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(coordinatesPress:)];
|
||||
[_coordinatesLabel addGestureRecognizer:press];
|
||||
|
|
|
@ -25,27 +25,29 @@
|
|||
- (void)layoutSubviews
|
||||
{
|
||||
CGFloat const xOffset = 20;
|
||||
CGFloat const yOffset = 14;
|
||||
CGFloat const height = [self.shareButton backgroundImageForState:UIControlStateNormal].size.height;
|
||||
if (self.apiAppTitle)
|
||||
{
|
||||
CGFloat const betweenOffset = 10;
|
||||
self.shareButton.frame = CGRectMake(xOffset, yOffset, (self.width - 2 * xOffset - betweenOffset) / 2, height);
|
||||
self.apiButton.frame = CGRectMake(self.shareButton.maxX + betweenOffset, yOffset, (self.width - 2 * xOffset - betweenOffset) / 2, height);
|
||||
self.shareButton.frame = CGRectMake(xOffset, 0, (self.width - 2 * xOffset - betweenOffset) / 2, height);
|
||||
self.apiButton.frame = CGRectMake(self.shareButton.maxX + betweenOffset, 0, (self.width - 2 * xOffset - betweenOffset) / 2, height);
|
||||
self.apiButton.hidden = NO;
|
||||
[self.apiButton setTitle:self.apiAppTitle forState:UIControlStateNormal];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.shareButton.frame = CGRectMake(xOffset, yOffset, self.width - 2 * xOffset, height);
|
||||
self.shareButton.frame = CGRectMake(xOffset, 0, self.width - 2 * xOffset, height);
|
||||
self.apiButton.hidden = YES;
|
||||
}
|
||||
self.apiButton.midY = self.height / 2;
|
||||
self.shareButton.midY = self.height / 2;
|
||||
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
|
||||
+ (CGFloat)cellHeight
|
||||
{
|
||||
return 70;
|
||||
return 54;
|
||||
}
|
||||
|
||||
- (void)shareButtonPressed:(id)sender
|
||||
|
@ -64,12 +66,12 @@
|
|||
{
|
||||
UIImage * image = [[UIImage imageNamed:@"PlacePageButton"] resizableImageWithCapInsets:UIEdgeInsetsMake(6, 6, 6, 6)];
|
||||
_shareButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
_shareButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17.5];
|
||||
_shareButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:18];
|
||||
_shareButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin;
|
||||
[_shareButton setBackgroundImage:image forState:UIControlStateNormal];
|
||||
[_shareButton addTarget:self action:@selector(shareButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_shareButton setTitle:NSLocalizedString(@"share", nil) forState:UIControlStateNormal];
|
||||
[_shareButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_shareButton setTitleColor:[UIColor colorWithColorCode:@"179E4D"] forState:UIControlStateNormal];
|
||||
[_shareButton setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
|
||||
}
|
||||
return _shareButton;
|
||||
|
@ -81,11 +83,11 @@
|
|||
{
|
||||
UIImage * image = [[UIImage imageNamed:@"PlacePageButton"] resizableImageWithCapInsets:UIEdgeInsetsMake(6, 6, 6, 6)];
|
||||
_apiButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
_apiButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17.5];
|
||||
_apiButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:18];
|
||||
_apiButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin;
|
||||
[_apiButton setBackgroundImage:image forState:UIControlStateNormal];
|
||||
[_apiButton addTarget:self action:@selector(apiButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_apiButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_apiButton setTitleColor:[UIColor colorWithColorCode:@"179E4D"] forState:UIControlStateNormal];
|
||||
[_apiButton setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
|
||||
}
|
||||
return _apiButton;
|
||||
|
|
|
@ -324,9 +324,9 @@ typedef NS_ENUM(NSUInteger, CellRow)
|
|||
CGFloat titleHeight = [self.title sizeWithDrawSize:CGSizeMake([self titleWidth], 200) font:self.titleLabel.font].height;
|
||||
CGFloat typesHeight = [self.types sizeWithDrawSize:CGSizeMake([self typesWidth], 200) font:self.typeLabel.font].height;
|
||||
if ([self iPhoneInLandscape] && !IPAD)
|
||||
return MAX(70, MAX(titleHeight, typesHeight) + 52);
|
||||
return MAX(titleHeight, typesHeight) + 52;
|
||||
else
|
||||
return MAX(82, titleHeight + typesHeight + 57);
|
||||
return titleHeight + typesHeight + 57;
|
||||
}
|
||||
|
||||
- (BOOL)iPhoneInLandscape
|
||||
|
@ -350,7 +350,7 @@ typedef NS_ENUM(NSUInteger, CellRow)
|
|||
_state = state;
|
||||
[self updateBookmarkStateAnimated:NO];
|
||||
[self updateBookmarkViewsAlpha:animated];
|
||||
// [self.tableView reloadData];
|
||||
[self.tableView reloadData];
|
||||
[self reloadHeader];
|
||||
[self alignAnimated:animated];
|
||||
[self.tableView setContentOffset:CGPointZero animated:animated];
|
||||
|
@ -365,12 +365,15 @@ typedef NS_ENUM(NSUInteger, CellRow)
|
|||
}
|
||||
}
|
||||
|
||||
#define BOTTOM_SHADOW_OFFSET 20
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
if (!updatingTable)
|
||||
{
|
||||
[self setState:self.state animated:YES withCallback:YES];
|
||||
self.tableView.frame = CGRectMake(0, [self headerHeight], self.superview.width, self.backgroundView.height);
|
||||
CGFloat const headerHeight = [self headerHeight];
|
||||
self.tableView.frame = CGRectMake(0, headerHeight, self.superview.width, self.backgroundView.height - headerHeight - BOTTOM_SHADOW_OFFSET);
|
||||
// [self reloadHeader];
|
||||
// [self alignAnimated:YES];
|
||||
}
|
||||
|
@ -414,7 +417,7 @@ typedef NS_ENUM(NSUInteger, CellRow)
|
|||
fullHeight += [PlacePageEditCell cellHeightWithTextValue:self.setName viewWidth:self.tableView.width];
|
||||
fullHeight += [PlacePageEditCell cellHeightWithTextValue:self.info viewWidth:self.tableView.width];
|
||||
}
|
||||
fullHeight = MIN(fullHeight, [self maxHeight]);
|
||||
fullHeight = MIN(fullHeight + 20, [self maxHeight]);
|
||||
self.headerSeparator.maxY = [self headerHeight];
|
||||
[UIView animateWithDuration:(animated ? 0.4 : 0) delay:0 damping:damping initialVelocity:0 options:options animations:^{
|
||||
self.arrowImageView.alpha = 0;
|
||||
|
@ -458,7 +461,8 @@ typedef NS_ENUM(NSUInteger, CellRow)
|
|||
if ([self isBookmark])
|
||||
{
|
||||
CGFloat newHeight = self.backgroundView.height + [PlacePageEditCell cellHeightWithTextValue:self.info viewWidth:self.tableView.width] + [PlacePageEditCell cellHeightWithTextValue:self.setName viewWidth:self.tableView.width];
|
||||
self.tableView.frame = CGRectMake(0, [self headerHeight], self.superview.width, newHeight);
|
||||
CGFloat const headerHeight = [self headerHeight];
|
||||
self.tableView.frame = CGRectMake(0, headerHeight, self.superview.width, newHeight - headerHeight - BOTTOM_SHADOW_OFFSET);
|
||||
}
|
||||
|
||||
// [self performAfterDelay:0 block:^{
|
||||
|
|
|
@ -12,13 +12,10 @@
|
|||
|
||||
- (id)init
|
||||
{
|
||||
UIImage * image = [UIImage imageNamed:@"CompassBackground"];
|
||||
UIImage * image = [UIImage imageNamed:@"CompassArrow"];
|
||||
self = [super initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
|
||||
UIImageView * background = [[UIImageView alloc] initWithImage:image];
|
||||
[self addSubview:background];
|
||||
|
||||
self.arrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"CompassArrow"]];
|
||||
self.arrow = [[UIImageView alloc] initWithImage:image];
|
||||
self.arrow.center = CGPointMake(self.width / 2, self.height / 2);
|
||||
[self addSubview:self.arrow];
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
@property (nonatomic) UIButton * searchButton;
|
||||
@property (nonatomic) UIButton * bookmarkButton;
|
||||
@property (nonatomic) UIButton * menuButton;
|
||||
@property (nonatomic) UIImageView * backgroundImageView;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -15,6 +16,8 @@
|
|||
{
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
[self addSubview:self.backgroundImageView];
|
||||
|
||||
[self.locationButton addTarget:self action:@selector(locationButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:self.locationButton];
|
||||
|
||||
|
@ -63,9 +66,15 @@
|
|||
self.menuButton.midX = self.bookmarkButton.midX + self.width * xBetweenPercent;
|
||||
}
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
||||
{
|
||||
UIView * view = [super hitTest:point withEvent:event];
|
||||
return view == self ? nil : view;
|
||||
}
|
||||
|
||||
- (UIButton *)buttonWithImageName:(NSString *)imageName
|
||||
{
|
||||
UIButton * button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 44)];
|
||||
UIButton * button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 79, 44)];
|
||||
button.contentMode = UIViewContentModeCenter;
|
||||
button.midY = self.height / 2;
|
||||
button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||
|
@ -78,7 +87,7 @@
|
|||
{
|
||||
if (!_locationButton)
|
||||
{
|
||||
_locationButton = [[LocationButton alloc] initWithFrame:CGRectMake(0, 0, 60, 44)];
|
||||
_locationButton = [[LocationButton alloc] initWithFrame:CGRectMake(0, 0, 79, 44)];
|
||||
_locationButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||
_locationButton.midY = self.height / 2;
|
||||
[_locationButton addTarget:self action:@selector(locationButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
@ -86,4 +95,15 @@
|
|||
return _locationButton;
|
||||
}
|
||||
|
||||
- (UIImageView *)backgroundImageView
|
||||
{
|
||||
if (!_backgroundImageView)
|
||||
{
|
||||
_backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ToolbarGradient"]];
|
||||
_backgroundImageView.frame = self.bounds;
|
||||
_backgroundImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
}
|
||||
return _backgroundImageView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Reference in a new issue