From fc9e0b5f916ac9285ffb9e564e6d9d9ec30ad954 Mon Sep 17 00:00:00 2001 From: VladiMihaylenko Date: Mon, 31 Oct 2016 11:59:09 +0300 Subject: [PATCH] [ios] Fixed incorrect cells size in iPAD. --- iphone/Maps/Classes/MWMBasePlacePageView.mm | 17 ++++++----------- iphone/Maps/Classes/MWMPlacePageInfoCell.mm | 12 ++---------- iphone/Maps/Classes/PlacePageLinkCell.xib | 6 +----- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/iphone/Maps/Classes/MWMBasePlacePageView.mm b/iphone/Maps/Classes/MWMBasePlacePageView.mm index 3c02ccf1cb..4d48e17b6e 100644 --- a/iphone/Maps/Classes/MWMBasePlacePageView.mm +++ b/iphone/Maps/Classes/MWMBasePlacePageView.mm @@ -690,20 +690,15 @@ using namespace storage; { case MWMPlacePageCellTypeBookmark: return ((MWMPlacePageBookmarkCell *)cell).cellHeight; case MWMPlacePageCellTypeOpenHours: return ((MWMPlacePageOpeningHoursCell *)cell).cellHeight; - default: - { - [cell setNeedsUpdateConstraints]; - [cell updateConstraintsIfNeeded]; - cell.bounds = {{}, {CGRectGetWidth(tableView.bounds), CGRectGetHeight(cell.bounds)}}; - [cell setNeedsLayout]; - [cell layoutIfNeeded]; - CGSize const size = - [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; - return size.height; - } + default: return UITableViewAutomaticDimension; } } +- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return UITableViewAutomaticDimension; +} + - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self cellsForSection:section].size(); diff --git a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm index 875191fb0a..37b42c547b 100644 --- a/iphone/Maps/Classes/MWMPlacePageInfoCell.mm +++ b/iphone/Maps/Classes/MWMPlacePageInfoCell.mm @@ -14,7 +14,6 @@ @property(weak, nonatomic, readwrite) IBOutlet UIImageView * icon; @property(weak, nonatomic, readwrite) IBOutlet id textContainer; -@property(weak, nonatomic) IBOutlet NSLayoutConstraint * textContainerHeight; @property(weak, nonatomic) IBOutlet UIButton * upperButton; @property(weak, nonatomic) IBOutlet UIImageView * toggleImage; @@ -33,10 +32,11 @@ if ([self.textContainer isKindOfClass:[UITextView class]]) { UITextView * textView = (UITextView *)self.textContainer; - textView.textContainerInset = {.left = -5, .top = 12}; + textView.textContainerInset = {.left = -5, .top = 12, .bottom = 12}; textView.keyboardAppearance = [UIColor isNightMode] ? UIKeyboardAppearanceDark : UIKeyboardAppearanceDefault; } + [self.icon layoutIfNeeded]; } - (void)configWithRow:(place_page::MetainfoRows)row data:(MWMPlacePageData *)data; @@ -143,19 +143,11 @@ [tv setAttributedText:[[NSAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName : [UIFont regular16]}]]; - [tv sizeToIntegralFit]; - CGFloat const minTextContainerHeight = 42.0; - CGFloat const bottomOffset = 8.0; - self.textContainerHeight.constant = - MAX(ceil(tv.contentSize.height) + bottomOffset, minTextContainerHeight); } else { UILabel * lb = (UILabel *)self.textContainer; [lb setText:text]; - [lb sizeToIntegralFit]; - CGFloat const trailingOffset = self.width - lb.maxX; - lb.font = trailingOffset < 32 ? [UIFont regular15] : [UIFont regular16]; } } diff --git a/iphone/Maps/Classes/PlacePageLinkCell.xib b/iphone/Maps/Classes/PlacePageLinkCell.xib index e753ae3b7c..7f38c6bcef 100644 --- a/iphone/Maps/Classes/PlacePageLinkCell.xib +++ b/iphone/Maps/Classes/PlacePageLinkCell.xib @@ -12,7 +12,7 @@ - + @@ -26,9 +26,6 @@ - - - Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. @@ -63,7 +60,6 @@ -