UITextField垂直alignment

有没有办法在UIControlContentVerticalAlignmentCenterUIControlContentVerticalAlignmentBottom之间的一半UITextField垂直alignment文本,还是我必须去与其中之一?

你应该inheritance一个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); }