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 + view height calculations wrong on iOS7 #58

Closed LeoNatan closed 11 years ago

LeoNatan commented 11 years ago

ios simulator screen shot aug 8 2013 19 02 02

This issue does not occur on iOS 6.

thermogl commented 11 years ago

I'm not setting aside time to work on this control until iOS 7 is closer to public release. I'm happy to merge pull requests if people fix this stuff, otherwise it'll have to wait :)

LeoNatan commented 11 years ago

I understand your position, but you should strive to have compatibility before GM is released. From a really quick look, the problem seems to stem from textRectForBounds:; it seems textviews behave somewhat differently with the returned value.

firanto commented 11 years ago

I think I know why this happening. According to my observation, in iOS7, UITextField seems set it's content vertical alignment to center. Because the text position grow linear with the height of the textfield. So I try to add this line of code in the - (void)setup method on TITokenField class implementation:

self.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;

I have test it on iOS 5, 6, and 7. Now the TITokenField behave normally. It seems that prior to iOS 7, the content's vertical alignment was set to top. This statement is just a conclusion resulted from my observation though. Still need to confirm this when NDA is revoked to backup this conclusion.

thermogl commented 11 years ago

Ah wonderful :)

LeoNatan commented 11 years ago

Nice one guys.

firanto commented 11 years ago

I'm glad that I can help :)

shivintu commented 11 years ago

Wonderful it worked.

sjkagathara commented 10 years ago

Good solution. Its working fine.

nguyenhoangtoan1203 commented 10 years ago

Thanks your fix! It's working fine.

codewrangler1 commented 10 years ago

kurotsukikaitou...Thanks for the fix. You just saved me hours of debug...:-)

bazik123 commented 10 years ago

thank. you.

imohsinj commented 10 years ago

@kurotsukikaitou Thanks a bunch..

dangluan commented 10 years ago

many thanks!