0

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

DShah
  • 9,768
  • 11
  • 71
  • 127
user851280
  • 11
  • 1
  • 4

4 Answers4

1

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.

KlimczakM
  • 12,576
  • 11
  • 64
  • 83
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256
  • This is my custom design see Image 2 and Image 3, UITableView Frame is fixed and will not changed. Any other alternate? – user851280 Jul 19 '11 at 07:00
  • then you need to manually do all things. Try to change your both tableView's classes to TPKeyboardAvoidingTableView that should do the trick. – Rahul Vyas Jul 19 '11 at 07:21
0

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
}
Vikas Rajput
  • 1,754
  • 1
  • 14
  • 26
0

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

Community
  • 1
  • 1
tipycalFlow
  • 7,594
  • 4
  • 34
  • 45
  • This is my custom design see Image 2 and Image 3, UITableView Frame is fixed and will not changed. Any other alternate? – user851280 Jul 19 '11 at 07:01
0

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.

Pete42
  • 916
  • 7
  • 15