I have done an application named “irewards” using Xcode 4.1 and it worked fine for me.Then for another application i have upgraded my Xcode to 4.2.1.Now when i try to run my first irewards ,it works on simulator but behaves strange on device.It have 2 textfields to insert username and password.When clicking on that it moves up.But does not showing the key board.Key board is missing.Sometimes a part of the key board is showing at the corner.The thing is that it works fine on simulator.Is this have any relation with the upgraded Xcode?anyone faced such an issue? i am using this code for moving up and down the text fields
- (void) keyboardWillShow: (NSNotification*) aNotification
{
int position = 0;
if ([username isFirstResponder])
position = 120;
else if ([password isFirstResponder]) position = 120;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
CGRect rect = [[self view] frame];
rect.origin.y -= position;
[[self view] setFrame: rect];
[UIView commitAnimations];
}
- (void) keyboardWillHide: (NSNotification*) aNotification
{
int position = 0;
if ([username isFirstResponder])
position = 120;
else if ([password isFirstResponder]) position = 120;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
CGRect rect = [[self view] frame];
rect.origin.y += position;
[[self view] setFrame: rect];
[UIView commitAnimations];
}
Try cleaning your project (in Xcode do Product>clean) and deleting the app from your device.
Build and run again.
Your app doesn’t control where the keyboard is drawn on screen so it wouldn’t have anything to do with your code.