2010-07-16 14 views
44

क्या UITextField में UIControlContentVerticalAlignmentCenter और UIControlContentVerticalAlignmentBottom के बीच आधे रास्ते को लंबवत रूप से संरेखित करने का कोई तरीका है या क्या मुझे उनमें से किसी एक के साथ जाना है?UITextField वर्टिकल संरेखण

+0

http://stackoverflow.com/questions/2694411/text-inset-for-uitextfield – titaniumdecoy

+1

की संभावित डुप्लिकेट @titaniumdecoy यह नहीं है। –

उत्तर

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); 
} 
संबंधित मुद्दे