Giter Site home page Giter Site logo

zftokenfield's Introduction

ZFTokenField

iOS custom view that let you add token view inside like NSTokenField

Installation

pod 'ZFTokenField'

Usage

ZFTokenFieldDataSource

You need to implement these in your datasource class

  • lineHeightForTokenInField:tokenField: return desire line height.
  • numberOfTokenInField: return number of token that you want to display.
  • tokenField:viewForTokenAtIndex: return view that you want to display at specify index

ZFTokenFieldDelegate

  • tokenMarginInTokenInField: your prefered margin, default is 0
  • tokenField:didRemoveTokenAtIndex: get called when user deletes token at particular index.
  • tokenField:didReturnWithText: get called when user hits return with text.
  • tokenField:didTextChanged: get called when user changes text.
  • tokenFieldDidBeginEditing: get called when user begins edit the field.
  • tokenFieldShouldEndEditing: get called to ask if the field should end editing.
  • tokenFieldDidEndEditing: get called when user stops edit the field.

Author

Amornchai Kanokpullwad, [email protected] @zoonref

License

ZFTokenField is available under the MIT license. See the LICENSE file for more info.

zftokenfield's People

Contributors

zoonooz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zftokenfield's Issues

Token textfield frame is shifted inward with empty placeholder

Hi,

Thanks for the wonderful work you have done.

If the token's textfield placeholder text is empty , the textfiled x origin is shifted inwards. ie if i set the placeholder text empty , and i start editing the text field, the initial text are not visible not . But however if i set 11 spaces or any anything in the range of 11 as the placeholder , the initial text is visible (frame is not shifted) .

iOS 7.1 support ?

Hi there,

just a small question, why are you only supporting iOS 7.1, and not 7.0 ?

Regards,

Can you give an option to disable editing?

Sometimes, you need to show a list of items, without adding and removing features.

Possible solution:

In ZFTokenField.h file

- (BOOL)tokenFieldShouldBeginEditing:(ZFTokenField *)textField;

In ZFTokenField.m file

- (BOOL)textFieldShouldBeginEditing:(ZFTokenTextField *)textField {
    if ([self.delegate respondsToSelector:@selector(tokenFieldShouldBeginEditing:)]) {
        return [self.delegate tokenFieldShouldBeginEditing:self];
    }

    return YES;
}

Crashing Inside TableViewCell

I have added ZFTokenView inside a UITableViewCell. At run time clicked inside the textfield and popped back to my previous view controller. Then again I came back to the view controller that has the token filed. It crashes the app with the following backtrace. Please help me to resolve.

* thread #1: tid = 0x149d0, 0x0000000104e0ddf2 QuartzCore`CALayerGetSuperlayer + 23, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3a726f74)
    frame #0: 0x0000000104e0ddf2 QuartzCore`CALayerGetSuperlayer + 23
    frame #1: 0x0000000105886b12 UIKit`-[UIView(UIKitManual) superview] + 42
    frame #2: 0x000000010513013a UIKit`-[UIView nextResponder] + 110
    frame #3: 0x00000001052afef1 UIKit`-[UIResponder _resignIfContainsFirstResponder] + 143
    frame #4: 0x00000001051437c4 UIKit`-[UIView(Hierarchy) _willMoveToWindow:] + 597
    frame #5: 0x0000000105151c9e UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 481
    frame #6: 0x00000001050829c8 UIKit`__53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_2 + 2217
    frame #7: 0x000000010514a680 UIKit`+[UIView(Animation) performWithoutAnimation:] + 65
    frame #8: 0x00000001050820bd UIKit`__53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 270
    frame #9: 0x000000010515082b UIKit`+[UIView(Internal) _performBlockDelayingTriggeringResponderEvents:] + 188
    frame #10: 0x0000000105081b02 UIKit`-[_UINavigationParallaxTransition animateTransition:] + 1465
    frame #11: 0x000000010526c2d9 UIKit`-[UINavigationController _startCustomTransition:] + 4156
    frame #12: 0x000000010527bb9b UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 712
    frame #13: 0x000000010527cd0b UIKit`-[UINavigationController __viewWillLayoutSubviews] + 57
    frame #14: 0x000000010542b503 UIKit`-[UILayoutContainerView layoutSubviews] + 248
    frame #15: 0x0000000105155980 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
    frame #16: 0x0000000104e09c00 QuartzCore`-[CALayer layoutSublayers] + 146
    frame #17: 0x0000000104dfe08e QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 366
    frame #18: 0x0000000104dfdf0c QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
    frame #19: 0x0000000104df23c9 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 277
    frame #20: 0x0000000104e20086 QuartzCore`CA::Transaction::commit() + 486
    frame #21: 0x000000010509572e UIKit`_UIApplicationHandleEventQueue + 7135
    frame #22: 0x00000001077fd301 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #23: 0x00000001077f322c CoreFoundation`__CFRunLoopDoSources0 + 556
    frame #24: 0x00000001077f26e3 CoreFoundation`__CFRunLoopRun + 867
    frame #25: 0x00000001077f20f8 CoreFoundation`CFRunLoopRunSpecific + 488
    frame #26: 0x0000000109b1dad2 GraphicsServices`GSEventRunModal + 161
    frame #27: 0x000000010509af09 UIKit`UIApplicationMain + 171
  * frame #28: 0x00000001035902df AppName`main(argc=1, argv=0x00007fff5c799678) + 111 at main.m:16
    frame #29: 0x000000010810992d libdyld.dylib`start + 1
    frame #30: 0x000000010810992d libdyld.dylib`start + 1

Auto resize tableview cell based on content

hi, library is awesome. I'm trying to use in tableview cell with with a view & assigning custom class to ZFTokenField, row height to "UITableViewAutomaticDimension" property. but it is not growing as per content, text is not visible not visible not completely while trying to add a tag.

textField becomeFirstResponder failed

I found that when current viewController show up again , the textField can't become first responder if return no in this method

- (BOOL)tokenFieldShouldEndEditing:(ZFTokenField *)textField
{
    return NO;
}

Impossibile End Editing

Hi, this library is amazing, i have found for now only one bug, i can't end editing, because the delegate method end editing return always NO, how i can achieve this?

the tokenfield doesn't increase size when full

I am creating ZFTokenField programmatically, but the field doesn't increase size, when it's filled up with tokens.
There is also a strange issue with the placeholder, it is only displaying the first 3 character of "Enter here".

About the keyboard

when I push in the viewController secondly which contains the ZFTokenField, the keyboard will not show again. How to solve the problem?

tokenField always has keyboard focus

in my project I have ZFTokenField and UITextView.
when I tap on ZFTokenField and after that when I tap on UITextView then focus could not be get into UITextView, its always focus on ZFTokenField

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.