44
有没有办法在UIControlContentVerticalAlignmentCenter
和UIControlContentVerticalAlignmentBottom
之间的中途将UITextField
中的文本垂直对齐,还是我必须使用其中的一种?UITextField垂直对齐
有没有办法在UIControlContentVerticalAlignmentCenter
和UIControlContentVerticalAlignmentBottom
之间的中途将UITextField
中的文本垂直对齐,还是我必须使用其中的一种?UITextField垂直对齐
你应该子类的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);
}
http://stackoverflow.com/questions/2694411/text-inset-for-uitextfield – titaniumdecoy 2011-03-08 23:49:23
的可能的复制@titaniumdecoy它不是。 – 2012-01-15 09:51:11