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

Fixed For Xcode4.6,customize abbreviation and token height #72

Open kmyhy opened 10 years ago

kmyhy commented 10 years ago
  1. Fixed: Property ' edgesForExtendedLayout' not found

'edgesForExtendedLayout' is only available in iOS 7.0 or later. If you compile 'TokenFieldExample' in iOS 6.1 SDK, you should get this error. You can check for it at compile-time using something like:

if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;

endif

  1. Add 'abbr' property

I used property 'abbr' and category ' NSString+truncateToSize' if users like customize their untoken text like 'Victoria Delgadillo... 4 联系人' rather than default '3 recipients'.

  1. can designate height

By default, the token field's height is fixed to 43 px. In iPad,it is fine.In iPhone,it is too tall. Maybe we should shorten it to 24 px so we can save more screen dimensions. Specify the frame parameter in ' initWithFrame ' no help for it.I refined the code so users can customize the token field's height.