Skip to content

Commit e0fb7fb

Browse files
author
Eric Millin
committed
Added ability to close keyboard with swipe gesture
1 parent fb6bd23 commit e0fb7fb

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

sample-code/apps/TestApp/Test App 2/MyViewControllerViewController.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,21 @@ - (void)viewDidLoad
6868
[computeSumButton setAccessibilityIdentifier:@"ComputeSumButton"];
6969
[answerLabel setAccessibilityIdentifier:@"Answer"];
7070
[locationStatus setAccessibilityIdentifier:@"locationStatus"];
71+
72+
UISwipeGestureRecognizer * swipe =[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeUp:)];
73+
swipe.direction = UISwipeGestureRecognizerDirectionUp;
74+
[self.view addGestureRecognizer:swipe];
75+
[swipe release];
7176

7277
computeSumButton.titleLabel.text = NSLocalizedString(@"main.button.computeSum", @"Compute Sum button");
7378
}
7479

80+
-(void)swipeUp:(UISwipeGestureRecognizer*)gestureRecognizer
81+
{
82+
[secondArg resignFirstResponder];
83+
}
84+
85+
7586
- (void)logLocationAuthFromTimer:(NSTimer *)timer
7687
{
7788
[self logLocationAuth];

sample-code/apps/TestApp/Test App 2/en.lproj/MyViewControllerViewController.xib

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<<<<<<< HEAD
23
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
4+
=======
5+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
6+
>>>>>>> Added ability to close keyboard with swipe gesture
37
<dependencies>
48
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
59
</dependencies>

0 commit comments

Comments
 (0)