iPhone上没有触发选择(适用于iPad)

时间:2014-03-14 21:09:01

标签: ios iphone objective-c xcode ipad

我从我的应用程序中得到一个奇怪的行为,我有两个故事板文件,一个用于iPad,另一个用于iPhone,在我的故事板中我有一个带有TableView的UIViewController 我从故事板中选择了原型单元格,并使用push类型的操作向另一个UIViewController添加了一个选择调用。

每次我点击我的手机测试我的应用程序使用我在这里使用的任何iPad时,一切都按预期发生,但是当我开始在任何iPhone(5,4,3GS)中测试我的应用程序时,我的桌子只需要#39 ; t执行选择。

当我选择执行推送到另一个segue时,我运行了一些逻辑:

-(BOOL) shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender; 

此行在iPad上调用,但不在iPhone中调用

这是我在iPhone故事板中的UITableView中的连接图片 iPhone UITableView storyboard

正如您所看到的iPad故事板中的连接相同 iPad UITableView storyboard

这是我的单元格触发选择调用另一个UIViewController,第一个来自我的iPhone故事板,另一个来自我的iPad故事板:

Cell iPhone storyboard Cell iPad storyboard

为了帮助您比较我的故事板,这里是我的故事板中的控制器代码:

iPhone

<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="6Gg-eR-53c">
    <rect key="frame" x="0.0" y="89" width="320" height="479"/>
    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
    <prototypes>
        <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="LojaCell" id="eyH-Fu-fm7">
            <rect key="frame" x="0.0" y="22" width="320" height="44"/>
            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
            <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eyH-Fu-fm7" id="28k-dO-gBn">
                <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
                <autoresizingMask key="autoresizingMask"/>
            </tableViewCellContentView>
            <connections>
                <segue destination="fFu-DS-IBm" kind="push" identifier="LojaSegue" id="4OD-1C-Xow"/>
            </connections>
        </tableViewCell>
    </prototypes>
    <connections>
        <outlet property="dataSource" destination="HDd-qp-Vu5" id="hjd-eg-wpV"/>
        <outlet property="delegate" destination="HDd-qp-Vu5" id="iFo-Pa-mRI"/>
    </connections>
</tableView>

ipad公司

<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="a6a-h4-Inj">
    <rect key="frame" x="0.0" y="89" width="768" height="935"/>
    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
    <prototypes>
        <tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="LojaCell" id="VK3-l3-sLl">
            <rect key="frame" x="0.0" y="22" width="768" height="44"/>
            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VK3-l3-sLl" id="1rm-J3-M5W">
                    <rect key="frame" x="0.0" y="0.0" width="735" height="43"/>
                    <autoresizingMask key="autoresizingMask"/>
                </tableViewCellContentView>
                <connections>
                    <segue destination="OwK-Um-sM3" kind="push" identifier="LojaSegue" id="WS4-PJ-fRi"/>
                </connections>
        </tableViewCell>
    </prototypes>
    <connections>
       <outlet property="dataSource" destination="KHn-sS-4WW" id="ee7-mU-vak"/>
       <outlet property="delegate" destination="KHn-sS-4WW" id="mlp-jH-KfD"/>
    </connections>
</tableView>

1 个答案:

答案 0 :(得分:0)

好的问题出在我的XCode上,不知道为什么,但有时XCode构建简单不起作用,我刚刚在这里找到了我的问题的解决方案:How to Empty Caches and Clean All Targets Xcode 4

另外,如果有人认为这个问题需要删除,因为问题不是首先描述的内容,只是在这里发表评论,我会删除这个问题。