Есть ли способ вертикально выровнять текст в UITextField
на полпути между UIControlContentVerticalAlignmentCenter
и UIControlContentVerticalAlignmentBottom
или мне нужно пойти с одним из них?
Вертикальное выравнивание UITextField
Ответ 1
Вы должны подклассифицировать UITextField и переопределить следующие методы:
- (CGRect) textRectForBounds: (CGRect) bounds
{
CGRect origValue = [super textRectForBounds: bounds];
/* Just a sample offset */
return CGRectOffset(origValue, 0.0f, 4.0f);
}
- (CGRect) editingRectForBounds: (CGRect) bounds
{
CGRect origValue = [super textRectForBounds: bounds];
/* Just a sample offset */
return CGRectOffset(origValue, 0.0f, 4.0f);
}