Note that there are some explanatory texts on larger screens.

plurals
  1. POText in UITextField moves up after editing (center while editing)
    primarykey
    data
    text
    <p>I have a strange problem. I have an UITextField in which the user should write the amount of something, so the field is called "amountField". Everything looks fine, when the user starts editing the textfield the text is in the vertical and horizontal center - that's great. </p> <p>However, when the user ends editing the text moves up a little bit. I tried many things, nothing helped... </p> <p>I am adding screenshots below, so you can see what is the problem.</p> <p>This is what it looks like while editing the field - that's ok.</p> <p><img src="https://i.stack.imgur.com/HKLjN.png" alt="This is while editing the field - that&#39;s ok."></p> <p>And this is how it looks when done editing - that is the <b>problem</b>!</p> <p><img src="https://i.stack.imgur.com/dtcS6.png" alt="This is the problem."></p> <p>Please, if anybody know what could cause this I would be very grateful! :)</p> <p>Here is some of my code related to the amountField.</p> <pre><code>amountField.keyboardType = UIKeyboardTypeNumberPad; amountField.returnKeyType = UIReturnKeyDone; amountField.delegate = self; [amountField setFont:[UIFont fontWithName:@"Nuptial Script LT Std" size:30]]; amountField.borderStyle = UITextBorderStyleNone; UIImage *amountBg = [UIImage imageNamed:@"skin2_ipad_amountField.png"]; [amountField setBackground:amountBg]; amountField.rightView = nil; //amountField.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.2]; amountField.textAlignment = UITextAlignmentCenter; amountField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; amountField.adjustsFontSizeToFitWidth = YES; amountLabel.textColor = UIColorFromARGB(0x313030); //Using my own macro amountField.frame = CGRectMake(300, 480, 136, 32); amountField.center = CGPointMake(605, 439); </code></pre> <p>PS: Those white corners are there because I set the background to white with 0.2 alpha, that's ok.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload