0

In the storyboard - I have set the button as the last subview for it to be above the background image. But still - I cannot see the button (I assume it is hidden under the image)

(referring to the second button, the go.png. The first one is OK)

image image

Edit: Apparently the tableview hides the button although it is prior to it in the storyboard Any idea?

the .storyboard snippet:

<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>
Boaz
  • 4,864
  • 12
  • 50
  • 90
  • Well, it is a challenge. Can you capture image about this button? – nmh Apr 24 '14 at 10:09
  • not sure how it helps but I got the image of the storyboard for you – Boaz Apr 24 '14 at 10:20
  • It looks like you want to add the button as a subview of the image view. See this: http://stackoverflow.com/questions/2415561/apple-interface-builder-adding-subview-to-uiimageview – trojanfoe Apr 24 '14 at 10:26
  • Also please put the image back as it's better than looking at XML. – trojanfoe Apr 24 '14 at 10:27
  • @trojanfoe - not sure I follow... see latest **edit** (brought back the images, sorry bout that) – Boaz Apr 24 '14 at 10:31
  • @trojanfoe - the imageviews are the "special" background images – Boaz Apr 24 '14 at 10:32
  • A subview appears in front of its parent view. Your current hierarchy has the button and image views as siblings so their display order is defined by the order in which they were added. Instead you want the button to be a subview of the image view and not the top-level view. – trojanfoe Apr 24 '14 at 10:33
  • Tried it. Didn't help. The problem is that it is behind the TableView (if it is somewhere else on the screen all OK). What can I do? – Boaz Apr 24 '14 at 10:52
  • Give us the source code, I will review it for you\ – nmh Apr 24 '14 at 13:58

1 Answers1

0

Possible Issue

This button may be outside the main UIView, or it may be with small size.

Possible Solution

First Show the Size Inspector for that button, and check the size and also the position of that button. If there are any negative values, try to change them.

Community
  • 1
  • 1
E-Riddie
  • 14,660
  • 7
  • 52
  • 74
  • size inspector an location is OK. I managed to figure out that the tableview hides it although it is below it on the story board. any fixes? – Boaz Apr 24 '14 at 10:27
  • Try to give autolayout to that image, and clip subviews of it – E-Riddie Apr 24 '14 at 10:32