关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。
想改进这个问题?将问题更新为 on-topic对于堆栈溢出。
8年前关闭。
Improve this question
我的应用程序出现了一个奇怪的行为,我有两个 Storyboard文件,一个用于 iPad,另一个用于 iPhone,在我的 Storyboard内我有一个 UIViewController 和一个 TableView
从 Storyboard 中,我刚刚选择了原型(prototype)单元格,并使用 push 类型的操作向另一个 UIViewController 添加了选择调用。
每次我点击使用任何 iPad 测试我的应用程序的单元格时,一切都会按预期发生,但是当我开始在任何 iPhone(5、4、3GS)上测试我的应用程序时,我的表只是不执行选择.
当我将选择设置为执行对另一个 segue 的推送时,我运行了一些逻辑:
-(BOOL) shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender;
此行在 iPad 上调用,但在 iPhone 上不调用
这是我在 iPhone Storyboard的 UITableView 中的连接图片
如您所见,我的 iPad Storyboard中的连接是相同的
这是我的单元触发选择调用另一个 UIViewController,第一个来自我的 iPhone Storyboard,另一个来自我的 iPad Storyboard:
为了帮助您比较我的 Storyboard ,这里是我来自 Storyboard 的 Controller 代码:
手机
<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>
最佳答案
好的,问题出在我的 XCode 上,不知道为什么,但有时 XCode build simple 不起作用,我刚刚在这里找到了解决问题的方法:How to Empty Caches and Clean All Targets Xcode 4
另外,如果有人认为这个问题需要删除,因为问题不是首先描述的问题,请在此处发表评论,我将删除该问题。
关于ios - iPhone 上未触发选择(适用于 iPad),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22415775/