6

BEFORE READING "iOS 7 OMG DOWNVOTE"

The problem has been solved and is not related to iOS 7 at all. The problem was that with autolayout turned on, you cannot change the frame directly but must edit constraints instead.

So I have an app that is in the App Store and I you type in some UITextFields but some of the text fields were covered by the keyboard so I programmatically moved them up. Now I am working with the Xcode and iOS 7 betas and this functionality stopped working. Here is my code:

-(void)textFieldDidBeginEditing:(UITextField *)textField{
    textFieldRect = textField.frame;
    textField.frame = CGRectMake(5, 80, self.view.frame.size.width-10, 31);
}
-(void)textFieldDidEndEditing:(UITextField *)textField{
    textField.frame = textFieldRect;
}

I check with an NSLog for the width of textFieldRect and TextField.frame at the end of textFieldDidBeginEditing: and the values are different (as they should be), yet there is no visual change. I know there are other ways to protect the textField from the keyboard, but I would really prefer to get this working as I hope to animate it, and I know that there is no reason this would not be possible.

WolfLink
  • 3,308
  • 2
  • 26
  • 44
  • 5
    It's under NDA so you should use the forums on apple's developer site. – uchuugaka Jun 16 '13 at 05:35
  • 19
    I love this "this is under NDA, let's downvote it" attitude... –  Jun 16 '13 at 05:48
  • 4
    @H2CO3 I agree it's stupid to cite an NDA as the reason for a close vote or a down vote, it's equally misguided to post a question about an unfinished SDK on an unfinished OS. – CodaFi Jun 16 '13 at 15:10
  • 4
    Why is there an ios7 tag if iOS 7 questions are not allowed? – WolfLink Jun 16 '13 at 15:36
  • And its not like `UITextField`s are some sort of new thing that your not supposed to talk about yet... – WolfLink Jun 16 '13 at 15:39
  • @CodaFi no, see http://meta.stackexchange.com/q/180573/183887 – djechlin Jun 16 '13 at 16:47
  • 3
    Regarding how to handle code under NDA see http://meta.stackexchange.com/q/94465/183887 – djechlin Jun 16 '13 at 16:49
  • @WolfLink UITextField isn't new, but your problems running your code on the *new OS* are. – CodaFi Jun 16 '13 at 17:13
  • Got answer to this question on the Apple Dev Forums. Turns out it wasn't really related to iOS 7; the problem was that autolayout prevents the frame from changing programmatically like that. – WolfLink Jul 03 '13 at 02:46

0 Answers0