Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions JSTokenField/JSTokenField.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
@protocol JSTokenFieldDelegate;

extern NSString *const JSTokenFieldFrameDidChangeNotification;
extern NSString *const JSTokenFieldTokenSecondTapNotification;

extern NSString *const JSTokenFieldNewFrameKey;
extern NSString *const JSTokenFieldOldFrameKey;
extern NSString *const JSDeletedTokenKey;
Expand Down
11 changes: 8 additions & 3 deletions JSTokenField/JSTokenField.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#import <QuartzCore/QuartzCore.h>

NSString *const JSTokenFieldFrameDidChangeNotification = @"JSTokenFieldFrameDidChangeNotification";
NSString *const JSTokenFieldTokenSecondTapNotification = @"JSTokenFieldTokenSecondTapNotification";
NSString *const JSTokenFieldNewFrameKey = @"JSTokenFieldNewFrameKey";
NSString *const JSTokenFieldOldFrameKey = @"JSTokenFieldOldFrameKey";
NSString *const JSDeletedTokenKey = @"JSDeletedTokenKey";
Expand Down Expand Up @@ -324,12 +325,16 @@ - (void)layoutSubviews

- (void)toggle:(id)sender
{
for (JSTokenButton *token in _tokens)
JSTokenButton *token = (JSTokenButton *)sender;
if (token.toggled) {
[[NSNotificationCenter defaultCenter] postNotificationName:JSTokenFieldTokenSecondTapNotification object:token];
}

for (JSTokenButton *t in _tokens)
{
[token setToggled:NO];
[t setToggled:NO];
}

JSTokenButton *token = (JSTokenButton *)sender;
[token setToggled:YES];
[token becomeFirstResponder];
}
Expand Down