forked from organicmaps/organicmaps
[ios] Fixed bookmark color view controller layout.
This commit is contained in:
parent
f260a12fda
commit
7fa6688d6c
5 changed files with 49 additions and 38 deletions
|
@ -21,11 +21,8 @@ extern NSArray * const kBookmarkColorsVariant;
|
|||
|
||||
- (void)configureWithColorString:(NSString *)colorString
|
||||
{
|
||||
CGFloat const leftOffset = 60.;
|
||||
CGFloat const rightOffset = 42.;
|
||||
self.currentImageName = colorString;
|
||||
self.titleLabel.text = L([colorString stringByReplacingOccurrencesOfString:@"placemark-" withString:@""]);
|
||||
self.titleLabel.width = self.bounds.size.width - leftOffset - rightOffset;
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<deployment version="2048" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMBookmarkColorViewController"/>
|
||||
|
@ -14,25 +15,42 @@
|
|||
<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="251" verticalHuggingPriority="251" text="Красный" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="15v-Tv-AWS">
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Красный" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="15v-Tv-AWS">
|
||||
<rect key="frame" x="60" y="11" width="216" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="tTa-sS-aNz"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.87" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_approve" id="icw-Gw-rjx">
|
||||
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_approve" translatesAutoresizingMaskIntoConstraints="NO" id="icw-Gw-rjx">
|
||||
<rect key="frame" x="290" y="15" width="14" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="14" id="2Ca-jV-Joa"/>
|
||||
<constraint firstAttribute="height" constant="14" id="zg7-xd-zPV"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="3MP-b3-Pk5">
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3MP-b3-Pk5">
|
||||
<rect key="frame" x="16" y="8" width="28" height="28"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="28" id="MEc-WT-81y"/>
|
||||
<constraint firstAttribute="height" constant="28" id="lHg-Zz-MZh"/>
|
||||
</constraints>
|
||||
<state key="normal">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="3MP-b3-Pk5" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="64U-gD-AsA"/>
|
||||
<constraint firstItem="3MP-b3-Pk5" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="8" id="7a2-pO-Tc8"/>
|
||||
<constraint firstItem="15v-Tv-AWS" firstAttribute="leading" secondItem="3MP-b3-Pk5" secondAttribute="trailing" constant="16" id="9KL-3W-kWV"/>
|
||||
<constraint firstItem="icw-Gw-rjx" firstAttribute="leading" secondItem="15v-Tv-AWS" secondAttribute="trailing" constant="14" id="YXB-LS-24F"/>
|
||||
<constraint firstItem="15v-Tv-AWS" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="3" id="msa-4l-qNz"/>
|
||||
<constraint firstItem="icw-Gw-rjx" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="7" id="r5R-sJ-PGL"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="icw-Gw-rjx" secondAttribute="trailing" constant="8" id="sIL-PN-YHv"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<connections>
|
||||
|
|
|
@ -21,6 +21,7 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
|
||||
@property (weak, nonatomic) IBOutlet UITableView * tableView;
|
||||
@property (nonatomic) BOOL colorWasChanged;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * tableViewHeight;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -64,38 +65,25 @@ static NSString * const kBookmarkColorCellIdentifier = @"MWMBookmarkColorCell";
|
|||
if (self.iPadOwnerNavigationController)
|
||||
return;
|
||||
|
||||
CGFloat const defaultHeight = 352.;
|
||||
CGSize const size = self.navigationController.view.bounds.size;
|
||||
CGFloat const topOffset = 24.;
|
||||
|
||||
CGFloat const defaultHeight = 352.;
|
||||
switch (orientation)
|
||||
{
|
||||
case UIInterfaceOrientationUnknown:
|
||||
break;
|
||||
|
||||
case UIInterfaceOrientationPortraitUpsideDown:
|
||||
case UIInterfaceOrientationPortrait:
|
||||
{
|
||||
CGFloat const width = MIN(size.width, size.height);
|
||||
CGFloat const height = MAX(size.width, size.height);
|
||||
CGFloat const externalHeight = self.navigationController.navigationBar.height + [[UIApplication sharedApplication] statusBarFrame].size.height;
|
||||
CGFloat const actualHeight = defaultHeight > (height - externalHeight) ? height : defaultHeight;
|
||||
self.tableView.frame = CGRectMake(0., topOffset, width, actualHeight);
|
||||
case UIInterfaceOrientationPortraitUpsideDown:
|
||||
case UIInterfaceOrientationUnknown:
|
||||
self.tableViewHeight.constant = defaultHeight;
|
||||
break;
|
||||
}
|
||||
|
||||
case UIInterfaceOrientationLandscapeLeft:
|
||||
case UIInterfaceOrientationLandscapeRight:
|
||||
{
|
||||
CGFloat const navBarHeight = self.navigationController.navigationBar.height + [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||
CGFloat const width = MAX(size.width, size.height);
|
||||
CGFloat const height = MIN(size.width, size.height);
|
||||
CGFloat const currentHeight = height - navBarHeight - 2 * topOffset;
|
||||
CGFloat const actualHeight = currentHeight > defaultHeight ? defaultHeight : currentHeight;
|
||||
self.tableView.frame = CGRectMake(0., topOffset, width, actualHeight);
|
||||
CGFloat const topOffset = 24.;
|
||||
CGFloat const navBarHeight = 64.;
|
||||
self.tableViewHeight.constant = MIN(defaultHeight, MIN(size.width, size.height) - 2 * topOffset - navBarHeight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
[self.tableView setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
<deployment version="2048" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMBookmarkColorViewController">
|
||||
<connections>
|
||||
<outlet property="tableView" destination="07I-Yr-hrI" id="cuQ-HB-occ"/>
|
||||
<outlet property="tableViewHeight" destination="Q3E-d1-c2p" id="4be-XT-doO"/>
|
||||
<outlet property="view" destination="TjH-fk-Ez1" id="avG-d0-UHK"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
|
@ -16,10 +17,12 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="1" sectionFooterHeight="1" id="07I-Yr-hrI">
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="1" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="07I-Yr-hrI">
|
||||
<rect key="frame" x="0.0" y="22" width="320" height="352"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="352" id="Q3E-d1-c2p"/>
|
||||
</constraints>
|
||||
<color key="separatorColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="-1" id="sfi-es-NXL"/>
|
||||
|
@ -28,6 +31,11 @@
|
|||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.96078431369999995" green="0.96078431369999995" blue="0.96078431369999995" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="07I-Yr-hrI" secondAttribute="trailing" id="VBs-Fh-muY"/>
|
||||
<constraint firstItem="07I-Yr-hrI" firstAttribute="leading" secondItem="TjH-fk-Ez1" secondAttribute="leading" id="eMR-5m-KpO"/>
|
||||
<constraint firstItem="07I-Yr-hrI" firstAttribute="top" secondItem="TjH-fk-Ez1" secondAttribute="top" constant="22" id="l4B-e3-TRl"/>
|
||||
</constraints>
|
||||
<simulatedOrientationMetrics key="simulatedOrientationMetrics"/>
|
||||
<point key="canvasLocation" x="931" y="273"/>
|
||||
</view>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue