Skip to content

Commit

Permalink
Update sample app to show resignFirstResponder.
Browse files Browse the repository at this point in the history
  • Loading branch information
ayanonagon committed Jun 24, 2014
1 parent 31bb067 commit 7a6c87c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions VENTokenFieldSample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
<action selector="didTapCollapseButton:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="U6u-9X-SSs"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GAb-7f-sMu">
<rect key="frame" x="80" y="226" width="161" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Resign First Responder">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="didTapResignFirstResponderButton:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Pjv-6d-781"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</view>
Expand Down
8 changes: 7 additions & 1 deletion VENTokenFieldSample/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ - (IBAction)didTapCollapseButton:(id)sender
[self.tokenField collapse];
}

- (IBAction)didTapResignFirstResponderButton:(id)sender
{
[self.tokenField resignFirstResponder];
}


#pragma mark - VENTokenFieldDelegate

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

- (void)tokenField:(VENTokenField *)tokenField didDeleteTokenAtIndex:(NSUInteger)index {
- (void)tokenField:(VENTokenField *)tokenField didDeleteTokenAtIndex:(NSUInteger)index
{
[self.names removeObjectAtIndex:index];
[self.tokenField reloadData];
}
Expand Down
7 changes: 7 additions & 0 deletions VENTokenFieldSampleTests/VENTokenFieldSampleTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@ - (void)testBasicFlow
[tester waitForAbsenceOfViewWithAccessibilityLabel:@"Octocat,"];
}

- (void)testResignFirstResponder
{
[tester tapViewWithAccessibilityLabel:@"To"];
[tester tapViewWithAccessibilityLabel:@"Resign First Responder"];
[tester waitForAbsenceOfKeyboard];
}

@end

0 comments on commit 7a6c87c

Please sign in to comment.