I just started learning to program iPhone apps and I can't seem to figure out how to make the view slide out of the way when the keyboard appears (so you can still see the text field you're typing in). How is it done?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- back button text does not change
相关文章
- 现在使用swift开发ios应用好还是swift?
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
suppose you need to move up view on a text field which tag is 4(when you have more than 1 txt fields and one of them covered by the keyboard) then use textField delegate method
this moves your view. now for moving down you need code in textField anothe delegate method
In case of textview you need to a button and for moving up your view you need this delegate
and use same code as textField
And moving down you need a button either in navigation bar or add in toolbar and set that tool bar over the keyboard by same animation.For button you need same code for moving down which is applicable for textField.
Hope this helps you.
If it is OK visually, the easiest is to move the entire self.view.frame and then move it back down when finished.
One way to do it is to contain everything in a UIScrollView and then scroll the contents upward. Another way is to move the view yourself, usually with the help of Core Animation to make it look nice.
A good place to start is with the documenation. There's even a section helpfully labelled Moving Content That Is Located Under the Keyboard which will point you in the right direction.
I found that using the keyboard notifications worked better for my application than using the UITextField delegate protocol of textFieldDidBeginEditing and textFieldDidEndEditing. The notifications are keyboardWillShow and keyboardWillHide. One can test for a UITextField or UITextView that would require the view to move withing these notifications and then conditionally move the view. The advantage in my application is that I have many UITextTields and the notifications make it easier to keep the view in place above the keyboard when editing moves from one field to the other.
}