Skip to content

Commit 7a6c87c

Browse files
committed
Update sample app to show resignFirstResponder.
1 parent 31bb067 commit 7a6c87c

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

VENTokenFieldSample/Base.lproj/Main.storyboard

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@
3131
<action selector="didTapCollapseButton:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="U6u-9X-SSs"/>
3232
</connections>
3333
</button>
34+
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GAb-7f-sMu">
35+
<rect key="frame" x="80" y="226" width="161" height="30"/>
36+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
37+
<state key="normal" title="Resign First Responder">
38+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
39+
</state>
40+
<connections>
41+
<action selector="didTapResignFirstResponderButton:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Pjv-6d-781"/>
42+
</connections>
43+
</button>
3444
</subviews>
3545
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
3646
</view>

VENTokenFieldSample/ViewController.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ - (IBAction)didTapCollapseButton:(id)sender
3030
[self.tokenField collapse];
3131
}
3232

33+
- (IBAction)didTapResignFirstResponderButton:(id)sender
34+
{
35+
[self.tokenField resignFirstResponder];
36+
}
37+
3338

3439
#pragma mark - VENTokenFieldDelegate
3540

@@ -39,7 +44,8 @@ - (void)tokenField:(VENTokenField *)tokenField didEnterText:(NSString *)text
3944
[self.tokenField reloadData];
4045
}
4146

42-
- (void)tokenField:(VENTokenField *)tokenField didDeleteTokenAtIndex:(NSUInteger)index {
47+
- (void)tokenField:(VENTokenField *)tokenField didDeleteTokenAtIndex:(NSUInteger)index
48+
{
4349
[self.names removeObjectAtIndex:index];
4450
[self.tokenField reloadData];
4551
}

VENTokenFieldSampleTests/VENTokenFieldSampleTests.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,11 @@ - (void)testBasicFlow
3838
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Octocat,"];
3939
}
4040

41+
- (void)testResignFirstResponder
42+
{
43+
[tester tapViewWithAccessibilityLabel:@"To"];
44+
[tester tapViewWithAccessibilityLabel:@"Resign First Responder"];
45+
[tester waitForAbsenceOfKeyboard];
46+
}
47+
4148
@end

0 commit comments

Comments
 (0)