UIButton没有显示

时间:2014-04-24 10:04:57

标签: ios objective-c uibutton storyboard

在故事板中 - 我将按钮设置为最后一个子视图,使其位于背景图像上方。 但仍然 - 我看不到按钮(我假设它隐藏在图像下面)

(指第二个按钮,go.png。第一个按钮是OK)

image image

修改: 显然,tableview隐藏了按钮,尽管它位于故事板之前 有什么想法吗?

.storyboard代码段:

<view key="view" contentMode="scaleToFill" id="VfA-Cc-YiX">
                        <rect key="frame" x="0.0" y="0.0" width="320" height="519"/>
                        <autoresizingMask key="autoresizingMask"/>
                        <subviews>
                            <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="background_photo.png" id="xWd-g0-aHG">
                                <rect key="frame" x="20" y="262" width="280" height="254"/>
                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                            </imageView>
                            <imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="fridge_top_part.png" id="Sg5-CB-aKi">
                                <rect key="frame" x="20" y="215" width="280" height="50"/>
                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                            </imageView>
                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="a6Z-L3-Daf">
                                <rect key="frame" x="35" y="267" width="250" height="244"/>
                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                <view key="tableFooterView" contentMode="scaleToFill" id="ATM-Ot-Ivk">
                                    <rect key="frame" x="0.0" y="0.0" width="250" height="330"/>
                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                                </view>
                            </tableView>
                            <imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="top_fridge.png" id="9qW-rM-RRr">
                                <rect key="frame" x="20" y="72" width="280" height="134"/>
                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                            </imageView>
                            <button opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="jP0-zQ-NGs">
                                <rect key="frame" x="45" y="109" width="240" height="37"/>
                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                <state key="normal" backgroundImage="whats_in_your_fridge.png">
                                    <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                                </state>
                                <connections>
                                    <segue destination="41Y-sX-NH8" kind="push" id="3Xy-Cf-d3a"/>
                                </connections>
                            </button>
                            <button opaque="NO" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="MWR-LQ-ebu">
                                <rect key="frame" x="250" y="475" width="50" height="41"/>
                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                <state key="normal" backgroundImage="Go.png">
                                    <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                                </state>
                                <connections>
                                    <segue destination="beU-gc-427" kind="push" id="9Ff-ak-y4O"/>
                                </connections>
                            </button>
                        </subviews>
                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                    </view>

1 个答案:

答案 0 :(得分:0)

可能的问题

此按钮可能位于主UIView之外,也可能是小尺寸。

可能的解决方案

该按钮的第一个Show the Size Inspector,并检查该按钮的大小和位置。如果有任何负值,请尝试更改它们。