I am implementing a control that behaves like an NSTokenField
(the address picker in Mail, for example) for use in iOS. I use a horizontal UICollectionView
and my rightmost cell is a UITextField
. This control will appear in a form with other textfields that have right-aligned text. For my new control to look right in this context, I'd like for the UITextField
to always be at the right edge of the UICollectionView
and for selected tags to appear to the left of it.
At the moment, when I first click into this row, the textfield scrolls to the left and then it gets pushed to the right as more tags are added. Once it is flush with the right edge of the UICollectionView
(when 'Appetizer' is added in the image below), then I start getting the behavior I want.
I've been thinking about something like a minimum width on the UITextField
so it takes up as much width as is available at first and less and less as tags are added. Or alternately, some way to pin the fixed-with field to the right. I haven't found a way to implement these ideas, though!
How can I make it so the textfield is always at the right of the UICollectionView
?