user851280
user851280

Reputation: 11

How to scroll UITableView When Keyboard hides the bottom half section of the screen

This is my custom design

I am trying to implement 2 simple UITableView. 1st UITableView covers top half of the screen and 2nd UITableView covers the bottom half of the screen. Each cell in the UITableView has an embedded UITextField. Whenever I select one of the (2nd UITableView) bottom text boxes, The Keyboard slides up, but the UITableView does not scroll, and the keyboard hides the input fields and 2nd UITableView too.

Suggest me what to do in this scenario. I am only using 2 UITableView.

For reference please find below links to the images:

Image 1

Image 2

Upvotes: 0

Views: 5098

Answers (4)

Vikas Rajput
Vikas Rajput

Reputation: 1874

PLease use IQKeyboardManager this will automatically Adjust the Scrolling Enough you have to put this code in your AppDelegate:-

 import IQKeyboardManagerSwift
 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

  IQKeyboardManager.shared.enable = true

  return true
}

Upvotes: 0

Rahul Vyas
Rahul Vyas

Reputation: 28750

You need to use one UITableView and use TPKeyboardAvoidingTableView class for your UITableView this class automatically manages scrolling of UITextFields inside UITableViewCells. You will get the sample code search on google for TPKeyboardAvoidingTableView.

Upvotes: 1

Pete42
Pete42

Reputation: 906

change the height of the tableview when the keyboard is shown and then when it is dismissed reset the height. Hope this answers you question.

Upvotes: 0

tipycalFlow
tipycalFlow

Reputation: 7644

There are answers available on stackoverflow related to your problem. Try this one: iPhone - Keyboard hides TextField

Upvotes: 0

Related Questions