Skip to content

Commit d1bce42

Browse files
committed
add example to walk and expose responder chain
1 parent 1ba52d9 commit d1bce42

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

bk1ch11p472action/bk1ch11p472action/Base.lproj/Main.storyboard

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@
3737
<action selector="buttonPressed:" destination="x5A-6p-PRh" eventType="touchUpInside" id="N6h-od-dCg"/>
3838
</connections>
3939
</button>
40+
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vfs-yC-YMh">
41+
<rect key="frame" x="69" y="264" width="119" height="30"/>
42+
<state key="normal" title="Responder Chain">
43+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
44+
</state>
45+
<connections>
46+
<action selector="showResponderChain:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="poO-6m-HyX"/>
47+
</connections>
48+
</button>
4049
</subviews>
4150
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
4251
</view>

bk1ch11p472action/bk1ch11p472action/ViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ class ViewController: UIViewController {
3030
}
3131

3232

33+
@IBAction func showResponderChain(sender: UIResponder) {
34+
var r : UIResponder?
35+
for (r = sender; r != nil; r = r!.nextResponder()) {
36+
println(r!)
37+
}
38+
}
3339

3440
}
3541

0 commit comments

Comments
 (0)