iOS地图视图 - 无法显示地图类型分段控件

时间:2015-05-05 14:46:06

标签: ios mapkit

我的项目(iOS8)有许多MKMapViews。在每个中,都有地图本身和显示地图类型的分段控件。除了一个之外,分段控件都可以工作。我无法想出最后一个控件有什么不同。

在故事板中,它看起来像这样:

enter image description here

以XML格式,本节如下:

 <!--Station Maps-->
        <scene sceneID="LeM-5s-2wf">
            <objects>
                <viewController title="Station Maps" id="hYA-cM-abP" customClass="StationMapViewController" sceneMemberID="viewController">
                    <layoutGuides>
                        <viewControllerLayoutGuide type="top" id="2a8-lC-bPP"/>
                        <viewControllerLayoutGuide type="bottom" id="QcK-rg-ebO"/>
                    </layoutGuides>
                    <view key="view" contentMode="scaleToFill" id="kcf-sT-UDP">
                        <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                        <subviews>
                            <mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" showsUserLocation="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yI9-me-Rg3">
                                <rect key="frame" x="0.0" y="44" width="600" height="558"/>
                            </mapView>
                            <segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="s2b-eX-v5B">
                                <rect key="frame" x="201" y="551" width="199" height="30"/>
                                <constraints>
                                    <constraint firstAttribute="width" constant="199" id="Bgo-vH-Ovn"/>
                                    <constraint firstAttribute="height" constant="29" id="pWC-nC-aW4"/>
                                </constraints>
                                <segments>
                                    <segment title="Standard"/>
                                    <segment title="Satellite"/>
                                    <segment title="Hybrid"/>
                                </segments>
                                <connections>
                                    <action selector="setMapType:" destination="hYA-cM-abP" eventType="valueChanged" id="gTQ-TR-i69"/>
                                </connections>
                            </segmentedControl>
                        </subviews>
                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                        <constraints>
                            <constraint firstItem="yI9-me-Rg3" firstAttribute="leading" secondItem="kcf-sT-UDP" secondAttribute="leading" id="7QQ-MR-baI"/>
                            <constraint firstItem="yI9-me-Rg3" firstAttribute="top" secondItem="2a8-lC-bPP" secondAttribute="bottom" id="Xg4-Br-oo6"/>
                            <constraint firstItem="s2b-eX-v5B" firstAttribute="centerX" secondItem="yI9-me-Rg3" secondAttribute="centerX" id="e3O-oO-939"/>
                            <constraint firstAttribute="bottomMargin" secondItem="yI9-me-Rg3" secondAttribute="bottom" constant="-2" id="kHP-sZ-bNy"/>
                            <constraint firstItem="QcK-rg-ebO" firstAttribute="top" secondItem="s2b-eX-v5B" secondAttribute="bottom" constant="20" id="kQT-6C-SAu"/>
                            <constraint firstItem="s2b-eX-v5B" firstAttribute="centerX" secondItem="kcf-sT-UDP" secondAttribute="centerX" id="klk-9a-NAw"/>
                        </constraints>
                    </view>
                    <toolbarItems>
                        <barButtonItem title="Item" id="oHZ-CA-um6"/>
                    </toolbarItems>
                    <navigationItem key="navigationItem" id="hfj-yd-fhd">
                        <barButtonItem key="leftBarButtonItem" title="Back" id="jFM-Qu-SCe">
                            <connections>
                                <action selector="back:" destination="hYA-cM-abP" id="fHl-I4-6Bu"/>
                            </connections>
                        </barButtonItem>
                    </navigationItem>
                    <nil key="simulatedStatusBarMetrics"/>
                    <nil key="simulatedBottomBarMetrics"/>
                    <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                    <size key="freeformSize" width="600" height="600"/>
                    <connections>
                        <outlet property="mapView" destination="yI9-me-Rg3" id="5tl-Dc-5bi"/>
                    </connections>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="ZGT-3J-F3u" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="10204" y="2917"/>
        </scene>
    </scenes>

我尝试通过逐字地移动一个在另一个之上或在另一个之上,或者突出显示一个元素并使用Arrange&gt;来交换地图视图和分段控件的位置。发回/转发。

所以,任何见解都会非常受欢迎。

0 个答案:

没有答案