rsattar / cltokeninputview Goto Github PK
View Code? Open in Web Editor NEWA replica of iOS's native contact bubbles UI
License: MIT License
A replica of iOS's native contact bubbles UI
License: MIT License
I expect the primary purpose of this widget is to provide as close to a 1:1 match with the native widget, but it would be nice to allow for a decoration item on a token.
In the case of using this for addressees it would be nice for the following purposes:
Is there a decent way to obtain a rect of the incomplete text for use as a popover source?
Hi guys,
I'm having a weird crash, when hitting backspace and having at least one token view.
Here's the crash.
*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<UICompatibilityInputViewController: 0x7f9241d61490> should have parent view controller:<ContactsSelectionViewController: 0x7f9241cbbc80> but requested parent is:<UIInputWindowController: 0x7f924201ac00>'
*** First throw call stack:
(
0 CoreFoundation 0x000000010b538f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010af89deb objc_exception_throw + 48
2 CoreFoundation 0x000000010b538e7d +[NSException raise:format:] + 205
3 UIKit 0x0000000109760f50 -[UIViewController _addChildViewController:performHierarchyCheck:notifyWillMove:] + 321
4 UIKit 0x0000000109f17845 -[UIInputWindowController changeToInputViewSet:] + 473
5 UIKit 0x0000000109f18ad8 __43-[UIInputWindowController setInputViewSet:]_block_invoke_21239 + 39
6 UIKit 0x0000000109f10806 -[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:] + 369
7 UIKit 0x0000000109f18aab __43-[UIInputWindowController setInputViewSet:]_block_invoke1238 + 98
8 UIKit 0x0000000109f0c968 -[UIInputWindowController performOperations:withTemplateNotificationInfo:] + 42
9 UIKit 0x0000000109f18765 -[UIInputWindowController setInputViewSet:] + 1194
10 UIKit 0x0000000109f1048e -[UIInputWindowController performOperations:withAnimationStyle:] + 50
11 UIKit 0x0000000109c1ad85 -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 1179
12 UIKit 0x00000001097d6bc1 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 81
13 UIKit 0x00000001097d3bea -[UIResponder becomeFirstResponder] + 617
14 UIKit 0x000000010966da1b -[UIView(Hierarchy) becomeFirstResponder] + 138
15 hyp 0x00000001054d0ded -[CLTokenView setSelected:animated:] + 125
16 hyp 0x00000001054ce33e -[CLTokenInputView selectTokenView:animated:] + 142
17 hyp 0x00000001054cd920 __48-[CLTokenInputView textFieldDidDeleteBackwards:]_block_invoke + 240
Basically it's triggered at [self becomeFirstResponder];
in
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
if (_selected == selected) {
return;
}
_selected = selected;
if (selected) {
[self becomeFirstResponder];
}
CGFloat selectedAlpha = (_selected ? 1.0 : 0.0);
if (animated) {
if (_selected) {
self.selectedBackgroundView.alpha = 0.0;
self.selectedBackgroundView.hidden = NO;
self.selectedLabel.alpha = 0.0;
self.selectedLabel.hidden = NO;
}
[UIView animateWithDuration:0.25 animations:^{
self.selectedBackgroundView.alpha = selectedAlpha;
self.selectedLabel.alpha = selectedAlpha;
} completion:^(BOOL finished) {
if (!_selected) {
self.selectedBackgroundView.hidden = YES;
self.selectedLabel.hidden = YES;
}
}];
} else {
self.selectedBackgroundView.hidden = !_selected;
self.selectedLabel.hidden = !_selected;
}
}
Any ideas?
thanks !
Hello, I am using tokenInputView but I have a question: How can I limit the height of tokenView when I add so many CLToken into it, or I want change direction scoll when available?? Please help me
I'd love to know! Links welcome!
When we entered a number in the input field and pressed return key in the keyboard the added number font is not increasing to the current font size.
When using a large font size, the message entry text box itself keeps the default font. In the native, the message composer also switches to a large font.
Similarly, when using a large font size, the whole "new message" composer and the add participants screen do not follow the larger font size and remain on default - screenshots below are taking with the largest font size setting but look as if I was on the default size (only the "New Message" header appears to have taken a larger font size).
Request to support the accessibility.
I am waiting for the response .
How can I detect the return key being pressed? I want to add a token when user hits return
I ported this project to Swift 2.x. Check it out here: https://github.com/rlaferla/CLTokenInputView-Swift
Is there a way to set up the backspace key to select and remove a token? Tapping a token to select it is great, but there should also be a way to delete it
I create an token and then i insert one letter. After that when i delete the letter the previous token is automatically selected, and after that when i want to insert some tex, the selected previous token is replaced with the text. How can i avoid to automatically selecting previous token when delete all input text?
@rsattar Is there anyway to remove last comma after the end of editing.?
Hi, it would be super handy to be able to specify the token delimiter. IN my personal use case, being able to suppress it all together (or set it to ' ') would make the one instance where people can only add a single item much tidier.
Hi there, really enjoying the library, but was wondering about a feature. My view is constrained to a cell, so it has a fixed height which it will never grow past. Is there a way that it can be made to scroll, if the content size is greater than the view's bounds?
I didn't see a clear way to implement it the demo, nor when reading through the code.
Thanks a lot!
Hi there, thank you very much for this library.
I'm wondering how to deal with this behavior:
Ideally the text field should grow instead of going behind the previous token. I was noticing that func tokenInputView(_ view: CLTokenInputView, didChangeHeightTo height: CGFloat)
is not called when the text could wrap to the next line.
Is this a bug, intended behavior, and/or has someone found a way to address this?
Could we have read/write access please
I would like to automatically bring up the keyboard so the user can immediately begin typing. Unfortunately [tokenInputView becomeFirstResponder]
doesn't do the trick.
@rsattar
I've modified the code inside CLTokenInputView.m
to resign keyboard like below.
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[self endEditing:YES];
return YES;
}
To end editing when user taps on Return key..
But isn't it grateful if we have an optional delegate.!!
Is there any workaround to put a view in InputAccessoryView ? Currently the property is read-only (From UIResponder), it needs to be overridden.
The idea is to put dismiss button in keyboard.
https://developer.apple.com/reference/uikit/uiresponder/1621119-inputaccessoryview
Incorrect keyboardType when selected a token.
Not every time, but sometimes removing token generates problem with it's height.
When there are two tokens are removing first one generating problem.
I've added background of CLTokenInputView
, so can track height of same.
Also blinking cursor's position is not correct. Please see attached screenshot.
Can you add limit of tokens?
Hello. I put using the same code in your sample application to write my app. But I dont know why the height of CLTokenInputView does not increase although token always add to it. I put my video here
Plz help.
CLTokenInputProblem.mov.zip
I'd like to change the textColor for the input view's textField. I've changed the background to a dark color and the default black doesn't show up well.
When a token is highlighted is it possible to have different behavior when the return key is pressed as opposed to the backspace key? I don't want the return key to delete the token, just to resign the keyboard.
Pressing backspace will deletes two characters at same time. I using it as single & multiple tokens, and as normal textField and all are separate instances for my usecase. I am working for iOS 8 and above.
Thank You.
I'm attempting to find a good solution for customizing the font of the fieldName
label (fieldLabel
). With #9 implemented (thank you), I'm able to customize the font of the tokens and input text as follows:
[UITextField appearanceWhenContainedIn:[CLTokenInputView class], nil].font = [UIFont italicSystemFontOfSize:20];
I hoped to be able to do the same for the label using the following:
[UILabel appearanceWhenContainedIn:[CLTokenInputView class], nil].font = [UIFont italicSystemFontOfSize:20];
But this produces the following results in your sample application (notice the truncated labels):
I've added those two lines to the beginning of -viewDidLoad
in CLTokenInputViewController.m
.
I've added a temporary work around to my app by setting fieldName
to nil
and back to it's intended value on the next run loop cycle inside of [[NSOperationQueue mainQueue] addOperationWithBlock:...]
, but this solution is less than ideal, and leads to further layout issues with the text insertion point after rotating the interface.
Do you have any recommendations for a solution or a fix in mind? I'd like to support dynamic type, and allow the field label to grow and shrink like the tokens and input text.
Also, thank you very much for the hard work on CLTokenInputView
!
im doing something like:
//remove all tokens
let tokens = searchTypeView.tokens
print("total tokens \(tokens.count)")
for (i, v) in searchTypeView.tokens.enumerate() {
print("remove toen \(i)")
print(v)
searchTypeView.removeToken(v)
}
why does it crash?
I thought this would be an excellent welcome to the party like how the messages app separates text message contacts as green and iMessage contacts as blue. I've made a pull request #35 that adds this functionality.
Cheers
Tim
Can you expose the UIKeyboardAppearanceType, please?
Just as the title explains :)
Hi. Great job with this library. I've used it before on other projects. However now I'm having a little problem when using it with swift.
I installed the library using cocoapods and imported the framework in my bridge file as #import <CLTokenInputView/CLTokenInputView.h>
(I need to use the use_frameworks flag for other frameworks I'm using in my project). Even though the bridge file is not complaining, I can't see CLTokenInputView from my swift classes.
What am I doing wrong?
Thanks for your help in advance.
If I type jeff,
, it'd be great if CLTokenInputView had the option to separate on that delimiter, not just return. Otherwise, people type jeff,
and hit enter, and are left with jeff,
in the token view.
I can't seem to find the correct area to customize the tokens... Any guidance?
The latest release of CLTokenInputView in CocoaPods is v2.3.0, which is behind the latest code in this repo which is marked 2.4.0.
Will v2.4.0 be released to CocoaPods?
CLTokenInputView.m
line 256 and 259
value stored to isOnFirstLine is never used
value stored to totalHeight is never used
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.