UITextField
途中でテキストを垂直方向に揃える方法はありますかUIControlContentVerticalAlignmentCenter
、UIControlContentVerticalAlignmentBottom
またはそれらのいずれかを使用する必要がありますか?
16615 次
1 に答える
4
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);
}
于 2012-12-10T03:54:25.053 に答える