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