forked from organicmaps/organicmaps
[ios] Added address in pp & layout fixes.
This commit is contained in:
parent
8462d6d2c4
commit
97d87daffa
8 changed files with 180 additions and 104 deletions
|
@ -1,15 +1,16 @@
|
|||
@class MWMPlacePageEntity, MWMDirectionView;
|
||||
@class MWMPlacePageEntity, MWMDirectionView, MWMPlacePageTypeDescriptionView;
|
||||
|
||||
@interface MWMBasePlacePageView : UIView
|
||||
@interface MWMBasePlacePageView : SolidTouchView
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * typeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * addressLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * distanceLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView * directionArrow;
|
||||
@property (weak, nonatomic) IBOutlet UITableView * featureTable;
|
||||
@property (weak, nonatomic) IBOutlet UIView * separatorView;
|
||||
@property (weak, nonatomic) IBOutlet UIButton * directionButton;
|
||||
@property (nonatomic) UIView * typeDescriptionView;
|
||||
@property (nonatomic) MWMPlacePageTypeDescriptionView * typeDescriptionView;
|
||||
|
||||
- (void)configureWithEntity:(MWMPlacePageEntity *)entity;
|
||||
- (void)addBookmark;
|
||||
|
|
|
@ -10,15 +10,17 @@
|
|||
#import "MWMPlacePageViewManager.h"
|
||||
#import "Statistics.h"
|
||||
|
||||
extern CGFloat const kBasePlacePageViewTitleBottomOffset = 2.;
|
||||
extern CGFloat const kBottomPlacePageOffset = 15.;
|
||||
|
||||
namespace
|
||||
{
|
||||
CGFloat const kPlacePageTitleKoefficient = 0.63;
|
||||
CGFloat const kLeftOffset = 16.;
|
||||
CGFloat const kDirectionArrowSide = 26.;
|
||||
CGFloat const kOffsetFromTitleToDistance = 12.;
|
||||
CGFloat const kOffsetFromDistanceToArrow = 8.;
|
||||
CGFloat const kTopOffset = 8.;
|
||||
CGFloat const kLabelsPadding = kLeftOffset * 2;
|
||||
CGFloat const kDirectionArrowSide = 20.;
|
||||
CGFloat const kOffsetFromTitleToDistance = 8.;
|
||||
CGFloat const kOffsetFromDistanceToArrow = 5.;
|
||||
CGFloat const kMaximumWidth = 360.;
|
||||
|
||||
MWMPlacePageCellTypeValueMap const gCellType2ReuseIdentifier{
|
||||
{MWMPlacePageCellTypeWiFi, "PlacePageInfoCell"},
|
||||
|
@ -39,6 +41,14 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
|||
ASSERT(haveCell, ());
|
||||
return haveCell ? @(it->second.c_str()) : @"";
|
||||
}
|
||||
|
||||
CGFloat placePageWidth()
|
||||
{
|
||||
CGSize const size = UIScreen.mainScreen.bounds.size;
|
||||
return IPAD ? kMaximumWidth : (size.width > size.height ? MIN(kMaximumWidth, size.height) : size.width);
|
||||
}
|
||||
|
||||
using EAttributePosition = NS_ENUM(NSUInteger) {Title, Type, Address};
|
||||
} // namespace
|
||||
|
||||
@interface MWMBasePlacePageView () <MWMPlacePageOpeningHoursCellProtocol>
|
||||
|
@ -68,6 +78,7 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
|||
[self.featureTable registerNib:[UINib nibWithNibName:identifier bundle:nil]
|
||||
forCellReuseIdentifier:identifier];
|
||||
}
|
||||
self.directionArrow.autoresizingMask = UIViewAutoresizingNone;
|
||||
}
|
||||
|
||||
- (void)configureWithEntity:(MWMPlacePageEntity *)entity
|
||||
|
@ -80,7 +91,6 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
|||
{
|
||||
MWMPlacePageEntity * entity = self.entity;
|
||||
MWMPlacePageEntityType const type = entity.type;
|
||||
self.directionArrow.autoresizingMask = UIViewAutoresizingNone;
|
||||
|
||||
if (type == MWMPlacePageEntityTypeBookmark)
|
||||
{
|
||||
|
@ -93,6 +103,20 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
|||
self.typeLabel.text = [entity.category capitalizedString];
|
||||
}
|
||||
|
||||
[self.typeDescriptionView removeFromSuperview];
|
||||
if (type == MWMPlacePageEntityTypeEle || type == MWMPlacePageEntityTypeHotel)
|
||||
{
|
||||
MWMPlacePageTypeDescription * description = [[MWMPlacePageTypeDescription alloc] initWithPlacePageEntity:entity];
|
||||
self.typeDescriptionView = (type == MWMPlacePageEntityTypeEle ? static_cast<MWMPlacePageTypeDescriptionView *>(description.eleDescription) :
|
||||
static_cast<MWMPlacePageTypeDescriptionView *>(description.hotelDescription));
|
||||
[self addSubview:self.typeDescriptionView];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.typeDescriptionView = nil;
|
||||
}
|
||||
|
||||
self.addressLabel.text = entity.address;
|
||||
BOOL const isMyPosition = type == MWMPlacePageEntityTypeMyPosition;
|
||||
BOOL const isHeadingAvaible = [CLLocationManager headingAvailable];
|
||||
using namespace location;
|
||||
|
@ -104,91 +128,114 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
|||
self.directionButton.hidden = hideDirection;
|
||||
|
||||
[self.featureTable reloadData];
|
||||
[self layoutSubviews];
|
||||
[self setNeedsLayout];
|
||||
[self layoutIfNeeded];
|
||||
}
|
||||
|
||||
#pragma mark - Layout
|
||||
|
||||
- (EAttributePosition)setupLabelsWidthWithBoundedWidth:(CGFloat)bound
|
||||
{
|
||||
CGFloat const labelsMaxWidth = placePageWidth() - kLabelsPadding;
|
||||
if ((self.typeLabel.text.length || self.typeDescriptionView) && self.addressLabel.text.length)
|
||||
{
|
||||
self.titleLabel.width = self.addressLabel.width = labelsMaxWidth;
|
||||
self.typeLabel.width = labelsMaxWidth - bound;
|
||||
return Type;
|
||||
}
|
||||
else if ((!self.typeLabel.text.length && !self.typeDescriptionView) && self.addressLabel.text.length)
|
||||
{
|
||||
self.titleLabel.width = labelsMaxWidth;
|
||||
self.typeLabel.width = 0;
|
||||
self.addressLabel.width = labelsMaxWidth - bound;
|
||||
return Address;
|
||||
}
|
||||
else if ((self.typeLabel.text.length || self.typeDescriptionView) && !self.addressLabel.text.length)
|
||||
{
|
||||
self.titleLabel.width = labelsMaxWidth;
|
||||
self.typeLabel.width = labelsMaxWidth - bound;
|
||||
self.addressLabel.width = 0;
|
||||
return Type;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.titleLabel.width = labelsMaxWidth - bound;
|
||||
self.typeLabel.width = self.addressLabel.width = 0;
|
||||
return Title;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
MWMPlacePageEntity * entity = self.entity;
|
||||
MWMPlacePageEntityType const type = entity.type;
|
||||
CGFloat const maximumWidth = 360.;
|
||||
CGSize const size = [UIScreen mainScreen].bounds.size;
|
||||
CGFloat const placePageWidth =
|
||||
IPAD ? maximumWidth : size.width > size.height ? MIN(maximumWidth, size.height) : size.width;
|
||||
CGFloat const maximumTitleWidth = kPlacePageTitleKoefficient * placePageWidth;
|
||||
BOOL const isExtendedType =
|
||||
type == MWMPlacePageEntityTypeEle || type == MWMPlacePageEntityTypeHotel;
|
||||
CGFloat const topOffset = (self.typeLabel.text.length > 0 || isExtendedType) ? 0 : 4.;
|
||||
CGFloat const typeBottomOffset = 10.;
|
||||
self.width = placePageWidth;
|
||||
self.titleLabel.width = maximumTitleWidth;
|
||||
[self.titleLabel sizeToFit];
|
||||
self.typeLabel.width = maximumTitleWidth;
|
||||
[self.typeLabel sizeToFit];
|
||||
CGFloat const typeMinY = self.titleLabel.maxY + kBasePlacePageViewTitleBottomOffset;
|
||||
|
||||
self.titleLabel.origin = CGPointMake(kLeftOffset, topOffset);
|
||||
self.typeLabel.origin = CGPointMake(kLeftOffset, typeMinY);
|
||||
|
||||
[self.typeDescriptionView removeFromSuperview];
|
||||
if (isExtendedType)
|
||||
[self layoutTypeDescription];
|
||||
|
||||
CGFloat const typeHeight =
|
||||
self.typeLabel.text.length > 0 ? self.typeLabel.height : self.typeDescriptionView.height;
|
||||
self.featureTable.minY = typeMinY + typeHeight + typeBottomOffset;
|
||||
self.separatorView.minY = self.featureTable.minY - 1;
|
||||
[self layoutDistanceLabelWithPlacePageWidth:placePageWidth];
|
||||
self.featureTable.height = self.featureTable.contentSize.height;
|
||||
self.height = typeBottomOffset + kBasePlacePageViewTitleBottomOffset + self.titleLabel.height +
|
||||
self.typeLabel.height + self.featureTable.height;
|
||||
}
|
||||
|
||||
- (void)layoutTypeDescription
|
||||
{
|
||||
MWMPlacePageEntity * entity = self.entity;
|
||||
CGFloat const typeMinY = self.titleLabel.maxY + kBasePlacePageViewTitleBottomOffset;
|
||||
MWMPlacePageTypeDescription * typeDescription =
|
||||
[[MWMPlacePageTypeDescription alloc] initWithPlacePageEntity:entity];
|
||||
self.typeDescriptionView = entity.type == MWMPlacePageEntityTypeHotel
|
||||
? (UIView *)typeDescription.hotelDescription
|
||||
: (UIView *)typeDescription.eleDescription;
|
||||
self.typeDescriptionView.autoresizingMask = UIViewAutoresizingNone;
|
||||
BOOL const typeLabelIsNotEmpty = self.typeLabel.text.length > 0;
|
||||
CGFloat const minX =
|
||||
typeLabelIsNotEmpty
|
||||
? self.typeLabel.minX + self.typeLabel.width + 2 * kBasePlacePageViewTitleBottomOffset
|
||||
: kLeftOffset;
|
||||
CGFloat const minY = typeLabelIsNotEmpty
|
||||
? self.typeLabel.center.y - self.typeDescriptionView.height / 2. - 1.
|
||||
: typeMinY;
|
||||
if (![self.subviews containsObject:self.typeDescriptionView])
|
||||
[self addSubview:self.typeDescriptionView];
|
||||
|
||||
self.typeDescriptionView.origin = CGPointMake(minX, minY);
|
||||
}
|
||||
|
||||
- (void)layoutDistanceLabelWithPlacePageWidth:(CGFloat)placePageWidth
|
||||
{
|
||||
CGFloat const maximumTitleWidth = kPlacePageTitleKoefficient * placePageWidth;
|
||||
CGFloat const distanceLabelWidthPositionLeft = placePageWidth - maximumTitleWidth - kDirectionArrowSide - 2 * kLeftOffset - kOffsetFromDistanceToArrow - kOffsetFromTitleToDistance;
|
||||
self.distanceLabel.width = distanceLabelWidthPositionLeft;
|
||||
self.distanceLabel.width = placePageWidth() - kLabelsPadding;
|
||||
[self.distanceLabel sizeToFit];
|
||||
CGFloat const directionArrowMinX = placePageWidth - kLeftOffset - kDirectionArrowSide;
|
||||
CGFloat const distanceLabelMinX = directionArrowMinX - self.distanceLabel.width - kOffsetFromDistanceToArrow;
|
||||
CGFloat const directionArrowCenterY = self.separatorView.maxY / 2.;
|
||||
self.directionArrow.center = CGPointMake(directionArrowMinX + kDirectionArrowSide / 2., directionArrowCenterY);
|
||||
self.distanceLabel.origin = CGPointMake(distanceLabelMinX, directionArrowCenterY - self.distanceLabel.height / 2.);
|
||||
self.directionButton.origin = self.directionArrow.origin;
|
||||
CGFloat const bound = self.distanceLabel.width + kDirectionArrowSide + kOffsetFromDistanceToArrow + kOffsetFromTitleToDistance;
|
||||
EAttributePosition const position = [self setupLabelsWidthWithBoundedWidth:bound];
|
||||
[self.titleLabel sizeToFit];
|
||||
[self.typeLabel sizeToFit];
|
||||
[self.addressLabel sizeToFit];
|
||||
[self layoutLabels];
|
||||
[self.typeDescriptionView layoutNearPoint:{self.typeLabel.maxX, self.typeLabel.minY}];
|
||||
[self layoutDistanceBoxWithPosition:position];
|
||||
[self layoutTableViewWithPosition:position];
|
||||
self.height = self.featureTable.height + self.separatorView.height + self.titleLabel.height + self.typeLabel.height + self.addressLabel.height + kBottomPlacePageOffset;
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
- (void)layoutLabels
|
||||
{
|
||||
// Prevent super call to stop event propagation
|
||||
// [super touchesBegan:touches withEvent:event];
|
||||
self.titleLabel.origin = {kLeftOffset, 0};
|
||||
self.typeLabel.origin = {kLeftOffset, self.titleLabel.maxY + kTopOffset};
|
||||
self.addressLabel.origin = {kLeftOffset, self.typeLabel.maxY + kTopOffset};
|
||||
}
|
||||
|
||||
- (void)layoutDistanceBoxWithPosition:(EAttributePosition)position
|
||||
{
|
||||
auto getY = ^ CGFloat (EAttributePosition p)
|
||||
{
|
||||
// Have to align distance box for the first label's line.
|
||||
CGFloat const defaultCenter = p == Title ? 12 : 8;
|
||||
switch (position)
|
||||
{
|
||||
case Title:
|
||||
return self.titleLabel.minY + defaultCenter;
|
||||
case Type:
|
||||
return self.typeLabel.minY + defaultCenter;
|
||||
case Address:
|
||||
return self.addressLabel.minY + defaultCenter;
|
||||
}
|
||||
};
|
||||
|
||||
CGFloat const distanceX = placePageWidth() - kLeftOffset - self.distanceLabel.width;
|
||||
CGFloat const directionX = distanceX - kOffsetFromDistanceToArrow - kDirectionArrowSide;
|
||||
CGFloat const y = getY(position);
|
||||
self.directionArrow.center = {directionX + kDirectionArrowSide / 2, y};
|
||||
self.distanceLabel.center = {distanceX + self.distanceLabel.width / 2, self.directionArrow.center.y};
|
||||
self.directionButton.center = self.directionArrow.center;
|
||||
}
|
||||
|
||||
- (void)layoutTableViewWithPosition:(EAttributePosition)position
|
||||
{
|
||||
auto getY = ^ CGFloat (EAttributePosition p)
|
||||
{
|
||||
switch (position)
|
||||
{
|
||||
case Title:
|
||||
return self.titleLabel.maxY + kBottomPlacePageOffset;
|
||||
case Type:
|
||||
return (self.addressLabel.text.length > 0 ? self.addressLabel.maxY : self.typeLabel.maxY) + kBottomPlacePageOffset;
|
||||
case Address:
|
||||
return self.addressLabel.maxY + kBottomPlacePageOffset;
|
||||
}
|
||||
};
|
||||
|
||||
self.separatorView.minY = getY(position);
|
||||
self.featureTable.minY = self.separatorView.maxY;
|
||||
self.featureTable.height = self.featureTable.contentSize.height;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)addBookmark
|
||||
{
|
||||
[[Statistics instance] logEvent:kStatEventName(kStatPlacePage, kStatToggleBookmark)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
@class MWMPlacePage;
|
||||
|
||||
@interface MWMPlacePageActionBar : UIView
|
||||
@interface MWMPlacePageActionBar : SolidTouchView
|
||||
|
||||
@property (nonatomic) BOOL isBookmark;
|
||||
@property (nonatomic) BOOL isPrepareRouteMode;
|
||||
|
|
|
@ -49,6 +49,7 @@ using MWMPlacePageCellTypeValueMap = map<MWMPlacePageCellType, string>;
|
|||
|
||||
@property (copy, nonatomic) NSString * title;
|
||||
@property (copy, nonatomic) NSString * category;
|
||||
@property (copy, nonatomic) NSString * address;
|
||||
@property (copy, nonatomic) NSString * bookmarkTitle;
|
||||
@property (copy, nonatomic) NSString * bookmarkCategory;
|
||||
@property (copy, nonatomic) NSString * bookmarkDescription;
|
||||
|
|
|
@ -173,6 +173,7 @@ NSString * mwmToOSMCuisineString(NSString * mwmCuisine)
|
|||
|
||||
- (void)configureForBookmark:(UserMark const *)bookmark
|
||||
{
|
||||
// TODO: There is need to get address info which store feature address.
|
||||
Framework & f = GetFramework();
|
||||
self.bac = f.FindBookmark(bookmark);
|
||||
self.type = MWMPlacePageEntityTypeBookmark;
|
||||
|
@ -192,6 +193,7 @@ NSString * mwmToOSMCuisineString(NSString * mwmCuisine)
|
|||
|
||||
- (void)configureForMyPosition:(MyPositionMarkPoint const *)myPositionMark
|
||||
{
|
||||
// TODO: There is need to get address info which store feature address.
|
||||
self.title = L(@"my_position");
|
||||
self.type = MWMPlacePageEntityTypeMyPosition;
|
||||
[self addMetaField:MWMPlacePageCellTypeCoordinate];
|
||||
|
@ -199,6 +201,7 @@ NSString * mwmToOSMCuisineString(NSString * mwmCuisine)
|
|||
|
||||
- (void)configureForApi:(ApiMarkPoint const *)apiMark
|
||||
{
|
||||
// TODO: There is need to get address info which store feature address.
|
||||
self.type = MWMPlacePageEntityTypeAPI;
|
||||
self.title = @(apiMark->GetName().c_str());
|
||||
self.category = @(GetFramework().GetApiDataHolder().GetAppTitle().c_str());
|
||||
|
@ -215,6 +218,7 @@ NSString * mwmToOSMCuisineString(NSString * mwmCuisine)
|
|||
NSString * const name = @(info.GetPinName().c_str());
|
||||
self.title = name.length > 0 ? name : L(@"dropped_pin");
|
||||
self.category = @(info.GetPinType().c_str());
|
||||
self.address = @(info.FormatAddress().c_str());
|
||||
|
||||
if (!info.m_house.empty())
|
||||
[self setMetaField:MWMPlacePageCellTypeBuilding value:info.m_house];
|
||||
|
@ -230,7 +234,7 @@ NSString * mwmToOSMCuisineString(NSString * mwmCuisine)
|
|||
if (self.category.length == 0)
|
||||
self.category = cuisine;
|
||||
else if (![self.category isEqualToString:cuisine])
|
||||
self.category = [NSString stringWithFormat:@"%@, %@", self.category, cuisine];
|
||||
self.category = [NSString stringWithFormat:@"%@ • %@", self.category, cuisine];
|
||||
break;
|
||||
}
|
||||
case Metadata::FMD_ELE:
|
||||
|
@ -244,7 +248,7 @@ NSString * mwmToOSMCuisineString(NSString * mwmCuisine)
|
|||
{
|
||||
NSString * bank = @(metadata.Get(type).c_str());
|
||||
if (self.category.length)
|
||||
self.category = [NSString stringWithFormat:@"%@, %@", self.category, bank];
|
||||
self.category = [NSString stringWithFormat:@"%@ • %@", self.category, bank];
|
||||
else
|
||||
self.category = bank;
|
||||
break;
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import "MWMPlacePageEntity.h"
|
||||
|
||||
@class MWMPlacePageELEDescription, MWMPlacePageHotelDescription;
|
||||
@interface MWMPlacePageTypeDescriptionView : UIView
|
||||
|
||||
- (void)layoutNearPoint:(CGPoint const &)point;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMPlacePageTypeDescription : NSObject
|
||||
|
||||
@property (strong, nonatomic) IBOutlet MWMPlacePageELEDescription * eleDescription;
|
||||
@property (strong, nonatomic) IBOutlet MWMPlacePageHotelDescription * hotelDescription;
|
||||
@property (strong, nonatomic) IBOutlet MWMPlacePageTypeDescriptionView * eleDescription;
|
||||
@property (strong, nonatomic) IBOutlet MWMPlacePageTypeDescriptionView * hotelDescription;
|
||||
|
||||
- (instancetype)initWithPlacePageEntity:(MWMPlacePageEntity *)entity;
|
||||
|
||||
|
|
|
@ -1,8 +1,23 @@
|
|||
#import "MWMPlacePageTypeDescription.h"
|
||||
|
||||
static NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescriptionView";
|
||||
namespace
|
||||
{
|
||||
|
||||
@interface MWMPlacePageELEDescription : UIView
|
||||
NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescriptionView";
|
||||
CGFloat const kLeftOffset = 8.0;
|
||||
|
||||
} // namespace
|
||||
|
||||
@implementation MWMPlacePageTypeDescriptionView
|
||||
|
||||
- (void)layoutNearPoint:(CGPoint const &)point
|
||||
{
|
||||
self.origin = {point.x + kLeftOffset, point.y};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMPlacePageELEDescription : MWMPlacePageTypeDescriptionView
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * heightLabel;
|
||||
|
||||
|
@ -10,7 +25,7 @@ static NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescrip
|
|||
|
||||
@end
|
||||
|
||||
@interface MWMPlacePageHotelDescription : UIView
|
||||
@interface MWMPlacePageHotelDescription : MWMPlacePageTypeDescriptionView
|
||||
|
||||
- (void)configureWithStarsCount:(NSUInteger)count;
|
||||
|
||||
|
@ -25,9 +40,10 @@ static NSString * const kPlacePageDescriptionViewNibName = @"MWMPlacePageDescrip
|
|||
{
|
||||
[[NSBundle mainBundle] loadNibNamed:kPlacePageDescriptionViewNibName owner:self options:nil];
|
||||
if (entity.type == MWMPlacePageEntityTypeEle)
|
||||
[self.eleDescription configureWithHeight:entity.typeDescriptionValue];
|
||||
[static_cast<MWMPlacePageELEDescription *>(self.eleDescription) configureWithHeight:entity.typeDescriptionValue];
|
||||
else
|
||||
[self.hotelDescription configureWithStarsCount:entity.typeDescriptionValue];
|
||||
[static_cast<MWMPlacePageHotelDescription *>(self.hotelDescription) configureWithStarsCount:entity.typeDescriptionValue];
|
||||
self.eleDescription.autoresizingMask = self.hotelDescription.autoresizingMask = UIViewAutoresizingNone;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include "Framework.h"
|
||||
|
||||
static CGFloat const kPlacePageBottomOffset = 31.;
|
||||
extern CGFloat const kBasePlacePageViewTitleBottomOffset;
|
||||
static CGFloat const kPlacePageDefaultOffset = 31.;
|
||||
extern CGFloat const kBottomPlacePageOffset;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
|
||||
{
|
||||
|
@ -160,10 +160,12 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
|
|||
CGFloat const width = isLandscape ? size.height : size.width;
|
||||
CGFloat const height = isLandscape ? size.width : size.height;
|
||||
MWMBasePlacePageView * basePPV = self.basePlacePageView;
|
||||
CGFloat const typeHeight = basePPV.typeLabel.text.length > 0 ? basePPV.typeLabel.height
|
||||
: basePPV.typeDescriptionView.height;
|
||||
CGFloat const h = height - (basePPV.titleLabel.height + kPlacePageBottomOffset + typeHeight +
|
||||
self.actionBar.height);
|
||||
CGFloat const typeHeight = (basePPV.typeLabel.text.length > 0 ? basePPV.typeLabel.height
|
||||
: static_cast<UIView *>(basePPV.typeDescriptionView).height) - 1;
|
||||
CGFloat const addressHeight = (basePPV.addressLabel.text.length > 0 ? basePPV.addressLabel.height + kBottomPlacePageOffset
|
||||
: 0) - 1;
|
||||
CGFloat const h = height - (basePPV.titleLabel.height + kPlacePageDefaultOffset + typeHeight +
|
||||
self.actionBar.height + addressHeight);
|
||||
return {width / 2, height + h};
|
||||
}
|
||||
|
||||
|
@ -189,10 +191,12 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
|
|||
CGSize const size = UIScreen.mainScreen.bounds.size;
|
||||
CGFloat const height = MAX(size.width, size.height);
|
||||
CGFloat const typeHeight = basePPV.typeLabel.text.length > 0 ? basePPV.typeLabel.height
|
||||
: basePPV.typeDescriptionView.height;
|
||||
: static_cast<UIView *>(basePPV.typeDescriptionView).height;
|
||||
CGFloat const addressHeight = basePPV.addressLabel.text.length > 0 ? basePPV.addressLabel.height + kBottomPlacePageOffset
|
||||
: 0;
|
||||
return height -
|
||||
(basePPV.titleLabel.height + kPlacePageBottomOffset + kBasePlacePageViewTitleBottomOffset +
|
||||
typeHeight + [(UITableView *)basePPV.featureTable height] + self.actionBar.height +
|
||||
(basePPV.titleLabel.height + kPlacePageDefaultOffset +
|
||||
typeHeight + addressHeight + [(UITableView *)basePPV.featureTable height] + self.actionBar.height +
|
||||
self.keyboardHeight);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue