質問

I'm using Xcode 5 and the iOS7 SDK to build my app. I am wanting to make a sign in page very similar to that of the iOS7 eBay app.

So what I would like to do is this:

  1. When the ViewController loads, I would like two UIButtons just above the keyboard
  2. Once the user has finished entering their information and hitting the done button - the keyboard disappears and background animates very slightly to show a logo at the top.

I'm thinking I should be listening for UIKeyboard notifications and then do things based on that.

Here are my questions:

  1. I am sure I can change the background image, based on the UIKeyboard notification status - how do I make it animate ? I don't want it to just appear?
  2. How do I position the UIButtons correctly to sit by the keyboard ?
役に立ちましたか?

解決

You should use the UIToolBar and set it as inputaccessoryview to the textFields. Here is one clean & clear solution for this problem.

Blog Post here

For backGround animation please use this. May be you can set the background logo alpha = 0 initially.

[UIView animateWithDuration:0.7 animations:^{
    self.view.logoImage.alpha = 1;
// make some more movements for anything that suits to your need.
// set frame of your textFields & any thing else that you need.

}
completion:^(BOOL finished){
    // may be you can load a new view controller here.
}];

Hope that helps.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top