thermogl / TITokenField

An iOS version of the NSTokenField (See To: field in Mail and Messages).
http://thermoglobalnuclearwar.com/opensource/
599 stars 172 forks source link

Caret position is not correct when use TITokenField separately (editing mode) #57

Closed ftkghost closed 10 years ago

ftkghost commented 11 years ago

Caret position is not correct when use TITokenField separately (editing mode).

Use TITokenField separately, the caret position is not correct when editing, it even does NOT match the baseline of placeholder label. After lines of TIToken, the caret may be out of TITokenField frame.

thermogl commented 11 years ago

What OS? I've seen this on 7, 6 should be fine.

ftkghost commented 11 years ago

It does happen on iOS 6.0 and 6.1. I tried to configure TITokenField in storyboard and code, the caret position is incorroct, even if I tried to add it like TITokenFieldView does in code. Could you please check TITokenField code like tectRectForBounds: ?

There are some of my TITokenField settings: PromptText: nil PlaceHolder: non-empty string. removesTokensOnEndEditing = NO Font: Helvetica-light size: 11 I also handled TITokenFieldControlEventFrameDidChange event (but did not handle TITokenFieldControlEventFrameWillChange), TITokenField size and position works well.

BTW: I found there are many magic numbers in TITokenField and TIToken, could you please make it configurable? Like token size, token interval, token field shadow, token margins, token text color. That will be useful for UI customization and keeping the same UI style. Thanks

thermogl commented 11 years ago

Creating an empty project and adding the token field like so results in the expected behaviour.

TITokenField * tokenField = [[TITokenField alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 23)];
[self.view addSubview:tokenField];

Can you create an example project to demonstrate the behaviour?

For customisation, the token size is based on the font size (which is customisable) and the shadow is configurable through CALayer's various shadow properties.

I've added properties on TIToken for text color.

acubillo commented 11 years ago

thermogl commented a month ago What OS? I've seen this on 7, 6 should be fine.

Hello, is this issue fixed for iOS7? Currently I'm implementing iOS7 support within my app and I have this issue. It works fine on iOS6.

Regards,

acubillo commented 11 years ago

Ohh nevermind I found how to fix it.

Just set [self setContentVerticalAlignment:UIControlContentVerticalAlignmentTop]; on the TITokenField - (void)setup method.

:)