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

UIMenuController with copy action #58

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

UIMenuController with copy action #58

wants to merge 6 commits into from

Conversation

etolstoy
Copy link

This pull request provides the ability to copy the value from the selected token.

Full description:
When the user long presses the token a UIMenuController is shown with one action - copy. You can specify what exactly would be copied using the new method from the VENTokenFieldDataSource protocol. It is useful, for example, when your tokens represent contacts email-addresses, but the actual text is the contact's username.
Besides it, as we added the UILongPressGestureRecognizer to the VENToken, I decided to give the user opportunity to add its own longPressBlock, if for some reasons he doesn't want to use the menu controller functionality.
And, of course, I've updated the README file.

@etolstoy etolstoy changed the title Feature/copy menu controller UIMenuController with copy action Mar 28, 2015
@etolstoy
Copy link
Author

etolstoy commented Apr 2, 2015

@ayanonagon, Hi, can you have a look at this PR? :)

@ayanonagon
Copy link
Contributor

Thank you for the PR! This is cool. Do you think the delegate method might be more clearly named as tokenField:copyStringForTokenAtIndex:? Also if the delegate does not implement that method, a sensible default might be the title of the token. Let me know what you think. :octocat:

@etolstoy
Copy link
Author

@ayanonagon Hi! Thanks for watching my PR. I've already tried to name this method as copyString:, but there was a problem with VENToken interface - it cannot have a copyString property, because copy a reserved system prefix.
And yes, it's a good idea to use the title as the default value - I'll add this functionality.

@etolstoy
Copy link
Author

@ayanonagon I've added the default value for copying and renamed all methods and properties from underlyingString to copyString. Have a look please.

@@ -57,6 +61,11 @@ - (void)setTitleText:(NSString *)text
[self.titleLabel sizeToFit];
}

- (void)setTokenCopyString:(NSString *)string
{
self.tokenCopyString = string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause an infinite loop! ♻️

@ayanonagon
Copy link
Contributor

Hi, sorry about the delay. Finally getting to catch up on some PR’s. I just tried this out and got stuck in an infinite loop.

Thanks for the PR! :octocat:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants