[ios] Updated PP and Toolbar for screenshooting

This commit is contained in:
Igor Khmurets 2014-08-01 11:22:28 +03:00 committed by Alex Zolotarev
parent 4feb95e755
commit dc1063f524
54 changed files with 77 additions and 60 deletions

View file

@ -605,11 +605,10 @@ const long long LITE_IDL = 431183278L;
- (UIStatusBarStyle)preferredStatusBarStyle
{
BOOL topViewsAreHidden = self.containerView.placePage.state == PlacePageStateHidden && self.searchView.state == SearchViewStateHidden;
if (self.apiMode)
return UIStatusBarStyleLightContent;
else
return topViewsAreHidden ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent;
return self.searchView.state != SearchViewStateHidden ? UIStatusBarStyleLightContent : UIStatusBarStyleDefault;
}
- (id)initWithCoder:(NSCoder *)coder

View file

@ -28,7 +28,7 @@ typedef NS_ENUM(NSUInteger, CellRow)
BOOL m_hasSpeed;
}
@property (nonatomic) UIView * backgroundView;
@property (nonatomic) UIImageView * backgroundView;
@property (nonatomic) UIView * headerView;
@property (nonatomic) UIView * headerSeparator;
@property (nonatomic) UITableView * tableView;
@ -275,12 +275,14 @@ typedef NS_ENUM(NSUInteger, CellRow)
[self.delegate placePageView:self willEditProperty:@"Description" inBookmarkAndCategory:GetFramework().FindBookmark([self userMark])];
}
#define TITLE_LABEL_LANDSCAPE_LEFT_OFFSET 20
#define TYPES_LABEL_LANDSCAPE_RIGHT_OFFSET 80
- (void)reloadHeader
{
self.titleLabel.text = self.title;
self.titleLabel.width = [self titleWidth];
[self.titleLabel sizeToFit];
self.titleLabel.origin = CGPointMake(20, 29);
if ([self isMyPosition])
self.typeLabel.text = [[MapsAppDelegate theApp].m_locationManager formattedSpeedAndAltitude:m_hasSpeed];
@ -288,26 +290,48 @@ typedef NS_ENUM(NSUInteger, CellRow)
self.typeLabel.text = self.types;
self.typeLabel.width = [self typesWidth];
[self.typeLabel sizeToFit];
self.typeLabel.origin = CGPointMake(self.titleLabel.minX, self.titleLabel.maxY + 1);
self.bookmarkButton.center = CGPointMake(self.headerView.width - 30, 42);
if ([self iPhoneInLandscape] && !IPAD)
{
self.titleLabel.origin = CGPointMake(12.5, 24);
self.typeLabel.textAlignment = NSTextAlignmentRight;
self.typeLabel.maxY = self.titleLabel.maxY;
self.typeLabel.maxX = self.width - TYPES_LABEL_LANDSCAPE_RIGHT_OFFSET;
self.bookmarkButton.center = CGPointMake(self.headerView.width - 24, 36);
}
else
{
self.titleLabel.origin = CGPointMake(15, 27);
self.typeLabel.textAlignment = NSTextAlignmentLeft;
self.typeLabel.origin = CGPointMake(self.titleLabel.minX, self.titleLabel.maxY + 2);
self.bookmarkButton.center = CGPointMake(self.headerView.width - 25, 39);
}
}
- (CGFloat)titleWidth
{
return self.width - 90;
return [self iPhoneInLandscape] ? self.width - 200 : self.width - 90;
}
- (CGFloat)typesWidth
{
return self.width - 90;
CGFloat const landscapeWidth = self.width - TITLE_LABEL_LANDSCAPE_LEFT_OFFSET - [self titleWidth] - TYPES_LABEL_LANDSCAPE_RIGHT_OFFSET - 8;
return [self iPhoneInLandscape] ? landscapeWidth : self.width - 90;
}
- (CGFloat)headerHeight
{
CGFloat titleHeight = [self.title sizeWithDrawSize:CGSizeMake([self titleWidth], 100) font:self.titleLabel.font].height;
CGFloat typesHeight = [self.types sizeWithDrawSize:CGSizeMake([self typesWidth], 30) font:self.typeLabel.font].height;
return MAX(74, titleHeight + typesHeight + 50);
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);
else
return MAX(82, titleHeight + typesHeight + 57);
}
- (BOOL)iPhoneInLandscape
{
return self.superview.width > self.superview.height && !IPAD;
}
- (void)setState:(PlacePageState)state animated:(BOOL)animated withCallback:(BOOL)withCallback
@ -326,11 +350,10 @@ 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.contentInset = UIEdgeInsetsMake([self headerHeight], 0, 0, 0);
[self.tableView setContentOffset:CGPointMake(0, -self.tableView.contentInset.top) animated:animated];
[self.tableView setContentOffset:CGPointZero animated:animated];
if (state != PlacePageStateHidden)
{
if ([[MapsAppDelegate theApp].m_locationManager enabledOnMap])
@ -347,10 +370,9 @@ typedef NS_ENUM(NSUInteger, CellRow)
if (!updatingTable)
{
[self setState:self.state animated:YES withCallback:YES];
self.tableView.frame = CGRectMake(0, 0, self.superview.width, self.backgroundView.height);
self.tableView.frame = CGRectMake(0, [self headerHeight], self.superview.width, self.backgroundView.height);
// [self reloadHeader];
// [self alignAnimated:YES];
// self.tableView.contentInset = UIEdgeInsetsMake([self headerHeight], 0, 0, 0);
}
}
@ -359,9 +381,6 @@ typedef NS_ENUM(NSUInteger, CellRow)
self.height = height;
self.backgroundView.height = height;
self.headerView.height = [self headerHeight];
CALayer * layer = [self.backgroundView.layer.sublayers firstObject];
layer.frame = self.backgroundView.bounds;
}
- (CGFloat)viewMinY
@ -439,7 +458,7 @@ 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, 0, self.superview.width, newHeight);
self.tableView.frame = CGRectMake(0, [self headerHeight], self.superview.width, newHeight);
}
// [self performAfterDelay:0 block:^{
@ -779,7 +798,13 @@ typedef NS_ENUM(NSUInteger, CellRow)
- (NSString *)types
{
if (!_types)
_types = [NSString stringWithUTF8String:[self addressInfo].GetPinType().c_str()];
{
NSString * types = [NSString stringWithUTF8String:[self addressInfo].GetPinType().c_str()];
if ([NSString instancesRespondToSelector:@selector(capitalizedStringWithLocale:)]) // iOS 6 and higher
_types = [types capitalizedStringWithLocale:[NSLocale currentLocale]];
else // iOS 5
_types = [types capitalizedString];
}
return _types;
}
@ -952,7 +977,7 @@ typedef NS_ENUM(NSUInteger, CellRow)
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
UIScrollView * sv = scrollView;
if ((sv.contentOffset.y + sv.height > sv.contentSize.height + 40) && !sv.dragging && sv.decelerating)
if (sv.contentOffset.y > 30 && !sv.dragging && sv.decelerating)
{
if (self.state == PlacePageStateOpened)
[self setState:PlacePageStateHidden animated:YES withCallback:YES];
@ -978,8 +1003,8 @@ typedef NS_ENUM(NSUInteger, CellRow)
{
_titleLabel = [[CopyLabel alloc] initWithFrame:CGRectZero];
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17.5];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:18];
_titleLabel.textColor = [UIColor blackColor];
_titleLabel.numberOfLines = 0;
_titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(titleTap:)];
@ -996,9 +1021,9 @@ typedef NS_ENUM(NSUInteger, CellRow)
{
_typeLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_typeLabel.backgroundColor = [UIColor clearColor];
_typeLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:15];
_typeLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:14];
_typeLabel.textAlignment = NSTextAlignmentLeft;
_typeLabel.textColor = [UIColor whiteColor];
_typeLabel.textColor = [UIColor blackColor];
_typeLabel.numberOfLines = 0;
_typeLabel.lineBreakMode = NSLineBreakByWordWrapping;
}
@ -1022,8 +1047,8 @@ typedef NS_ENUM(NSUInteger, CellRow)
{
if (!_headerView)
{
_headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, [self headerHeight])];
_headerView.backgroundColor = [UIColor applicationColor];
_headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 0)];
_headerView.backgroundColor = [UIColor clearColor];
_headerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
@ -1083,21 +1108,13 @@ typedef NS_ENUM(NSUInteger, CellRow)
return _tableView;
}
- (UIView *)backgroundView
- (UIImageView *)backgroundView
{
if (!_backgroundView)
{
_backgroundView = [[UIView alloc] initWithFrame:self.bounds];
_backgroundView = [[UIImageView alloc] initWithFrame:self.bounds];
_backgroundView.image = [[UIImage imageNamed:@"PlacePageBackground"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 20, 0)];
_backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
CAGradientLayer * gradient = [CAGradientLayer layer];
gradient.colors = @[(id)[[UIColor colorWithColorCode:@"15d180"] CGColor], (id)[[UIColor colorWithColorCode:@"16b68a"] CGColor]];
gradient.startPoint = CGPointMake(0, 0);
gradient.endPoint = CGPointMake(0, 1);
gradient.locations = @[@0, @1];
gradient.frame = _backgroundView.bounds;
[_backgroundView.layer addSublayer:gradient];
}
return _backgroundView;
}

View file

@ -15,8 +15,6 @@
{
self = [super initWithFrame:frame];
self.backgroundColor = [[UIColor colorWithColorCode:@"414451"] colorWithAlphaComponent:0.9];
[self.locationButton addTarget:self action:@selector(locationButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:self.locationButton];

View file

@ -3,12 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "menu-buy-pro.png"
"filename" : "MenuBuyPro.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "menu-buy-pro@2x.png"
"filename" : "MenuBuyPro@2x.png"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -3,12 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "my-position.png"
"filename" : "MyPosition.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "my-position@2x.png"
"filename" : "MyPosition@2x.png"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

View file

@ -3,12 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "my-position-auto-follow.png"
"filename" : "MyPositionAutoFollow.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "my-position-auto-follow@2x.png"
"filename" : "MyPositionAutoFollow@2x.png"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -3,12 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "my-position-search.png"
"filename" : "MyPositionSearch.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "my-position-search@2x.png"
"filename" : "MyPositionSearch@2x.png"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 997 B

View file

@ -3,12 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "my-position-pressed.png"
"filename" : "MyPositionPressed.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "my-position-pressed@2x.png"
"filename" : "MyPositionPressed@2x.png"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 720 B

View file

@ -2,7 +2,8 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
"scale" : "1x",
"filename" : "PlacePageBackground.png"
},
{
"idiom" : "universal",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -2,7 +2,8 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
"scale" : "1x",
"filename" : "PlacePageBookmarkButton.png"
},
{
"idiom" : "universal",

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -2,7 +2,8 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
"scale" : "1x",
"filename" : "PlacePageBookmarkButtonSelected.png"
},
{
"idiom" : "universal",

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -3,12 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "star.png"
"filename" : "Bookmark.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "star@2x.png"
"filename" : "Bookmark@2x.png"
}
],
"info" : {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -3,12 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "menu.png"
"filename" : "Settings.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "menu@2x.png"
"filename" : "Settings@2x.png"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,020 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -3,12 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "search.png"
"filename" : "Search.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "search@2x.png"
"filename" : "Search@2x.png"
}
],
"info" : {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 4 KiB