[iphonex] [ios] Updated bookmarks layout.

This commit is contained in:
Ilya Grechuhin 2017-12-25 13:44:07 +03:00 committed by Roman Kuznetsov
parent 4c58eb8731
commit a4577c1103
2 changed files with 12 additions and 4 deletions

View file

@ -36,8 +36,6 @@ extern NSString * const kBookmarkCategoryDeletedNotification =
// Used to display add bookmarks hint
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
CGFloat const offset = 10;
CGRect const rect = tableView.bounds;
// Use UILabel inside custom view to add padding on the left and right (there is no other way to do it)
if (!m_hint)
@ -65,6 +63,13 @@ extern NSString * const kBookmarkCategoryDeletedNotification =
[m_hint addSubview:label];
}
UILabel * label = m_hint.subviews.firstObject;
CGFloat offset = 10;
if (@available(iOS 11.0, *))
{
UIEdgeInsets const safeAreaInsets = tableView.safeAreaInsets;
offset = max(max(safeAreaInsets.top, safeAreaInsets.bottom), max(safeAreaInsets.left, safeAreaInsets.right));
}
label.bounds = CGRectInset(rect, offset, offset);
[label sizeToIntegralFit];
m_hint.bounds = CGRectMake(0, 0, rect.size.width, label.bounds.size.height + 2 * offset);

View file

@ -19,8 +19,11 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="501" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="42" translatesAutoresizingMaskIntoConstraints="NO" id="y2T-Xq-sVO">
<rect key="frame" x="22" y="0.0" width="42" height="43"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="501" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="y2T-Xq-sVO">
<rect key="frame" x="22" y="0.0" width="42" height="44"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="999" constant="44" id="ZM5-mG-qDZ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>