Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding contiguous deletion from the middle of a list and scrolling to highlighted token #67

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f868b25
highlight and scroll to deleted tokens
kwgithubusername May 13, 2015
73c603a
consistent deletion of consecutive items
kwgithubusername May 14, 2015
98c0e9a
remove observer in dealloc
kwgithubusername May 14, 2015
204f1d2
add define strings for shrinking notification
kwgithubusername May 14, 2015
b417256
maintain cursor when deleting from end
kwgithubusername May 14, 2015
442d47c
document changes in more detail
kwgithubusername May 14, 2015
fcd84f9
use this commit if you only want contiguous deletion feature
kwgithubusername May 14, 2015
646b5c7
use this commit for both contiguous deletion and scrolling to highlig…
kwgithubusername May 14, 2015
ea05c1a
remove unnecessary notification
kwgithubusername May 14, 2015
4eccea3
maintain normal deletion behavior at the end of the list
kwgithubusername May 14, 2015
2252927
use this newer commit for contiguous deletion in middle of list only
kwgithubusername May 14, 2015
488ba66
use this newer commit for contiguous deletion in middle of list and s…
kwgithubusername May 14, 2015
f150cc5
separate features into methods
kwgithubusername May 14, 2015
d0e5c99
fix if conditions that were preventing the prior token index from bei…
kwgithubusername May 14, 2015
2cce859
fix missing highlighted token when second to last token selected
kwgithubusername May 14, 2015
1ac36d3
need to anticipate middle deletions for longer lists, will attempt to…
kwgithubusername May 14, 2015
c1fd9e4
prevent indexoftokenpriortodeletedtoken from being set to less than zero
kwgithubusername May 14, 2015
a3c754e
prevent continued highlighting from occuring when adding tokens
kwgithubusername May 14, 2015
e05e10d
use contentSize instead of bounds for detecting height changes to cov…
kwgithubusername May 14, 2015
f337b71
focusInputTextField only when adding items
kwgithubusername May 14, 2015
4eca987
focus on textfield when typing
kwgithubusername May 14, 2015
0220f16
revert changes to original
kwgithubusername May 15, 2015
c0d4cac
revert pbxproj to original
kwgithubusername May 15, 2015
c5c068d
remove dated comment
kwgithubusername May 15, 2015
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
Prev Previous commit
Next Next commit
remove unnecessary notification
kwgithubusername committed May 14, 2015
commit ea05c1a3b2ae9e6f7a675d2be056e6afd45b613b
14 changes: 2 additions & 12 deletions VENTokenField/VENTokenField.m
Original file line number Diff line number Diff line change
@@ -26,8 +26,6 @@
#import "VENToken.h"
#import "VENBackspaceTextField.h"

#define VENDidShrinkBoundsHeightNotification @"VENDidShrinkBoundsHeightNotification"

static const CGFloat VENTokenFieldDefaultVerticalInset = 7.0;
static const CGFloat VENTokenFieldDefaultHorizontalInset = 15.0;
static const CGFloat VENTokenFieldDefaultToLabelPadding = 5.0;
@@ -112,11 +110,6 @@ - (void)setUpInit
[self reloadData];

// When deleting items in the middle of the list rather than at the end, the highlighted token is lost when the view shrinks, so observe for when the view shrinks and highlight the appropriate token

[[NSNotificationCenter defaultCenter] addObserverForName:VENDidShrinkBoundsHeightNotification object:self queue:nil usingBlock:^(NSNotification *note) {
VENToken *tokenToHighlight = self.tokens[self.indexOfTokenPriorToDeletedToken];
tokenToHighlight.highlighted = YES;
}];
}

- (void)collapse
@@ -182,10 +175,6 @@ - (NSString *)inputText

#pragma mark - View Layout

- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self forKeyPath:VENDidShrinkBoundsHeightNotification];
}

- (void)layoutSubviews
{
CGFloat newHeight = self.bounds.size.height;
@@ -199,7 +188,8 @@ - (void)layoutSubviews

if (newHeight < self.oldHeight)
{
[[NSNotificationCenter defaultCenter] postNotificationName:VENDidShrinkBoundsHeightNotification object:self];
VENToken *tokenToHighlight = self.tokens[self.indexOfTokenPriorToDeletedToken];
tokenToHighlight.highlighted = YES;
}
self.oldHeight = self.bounds.size.height;
}