I have a tableview with a header and under that header I've a couple of UITextFields inside a UITableViewCell. The problem is that when I press the top UITextField, the UITextField scrolls underneath the headerView. How do I prevent this from happening? I've disabled scrolling in the tableview.
Thanks
I just needed to split up the UITableViewCell containing two UITextFields to two UITableViewCells (each containing a UITextField).
Related
I've created a simple project. It contains a UITableViewController with self-sizing prototype cells that contain a UITextField and a UILabel for displaying validation message. The controls are grouped in a UIStackView, but that doesn't seem to matter.
The label is only visible if there is a message to display, otherwise it's size collapses to 0. To adjust the size of the cell I simple call the recommended:
tableView.beginUpdates()
tableView.endUpdates()
If I scroll the view with the UITextfield remaining first responder (ie w/o dismissing the keyboard), so that the cell is no longer visible, when scrolling back to the cell, it is misaligned.
I've hosted the sample project at https://github.com/ionel71089/tableViewTextField
Note:
Easiest way to reproduce is on Simulator iPhone 6 9.2, by editing let's say the 50th cell, scrolling to the top and then back to the cell.
I have a UITableView with custom cells,those cells contain some textFields,segmented index and all.Once i entered the data in particular cell textfield and segmented index after that i scrolled the tableview data contents disappears and overlapping.Can anyone tell me how to resolve the issue and how should i code.
Use IBOutlet in UITableViewCell because if you create segmented control,textfield as subviews after scrolling down they will be added as subviews every time you Scroll.
I am new to iOS programming.
My confusion is on one UIView. I am adding two UITableViews
For second TableView I am using custom TableView Cells. On that TableViewCell I am adding TextFields.
First table Views also I have text fields.
Now On The View I should Use UIScrollView. How can I Handle Scroll View here when I click on all these text Fields.
I have a UITableView in which I have several custom cells and my last cell contains a UISearchbar in it. I have wired up the appropriate delegates and referencing outlets and can get the keyboard to show up.
The problem I am facing is that the searchbar is at the very bottom of my tableview i.e. it is part of the very last cell. So even though the keyboard gets shown, the searchbar is hidden below it as I suspect it is unable to scroll to that location since its the last cell in the view.
Does anyone have any thoughts on this and how to overcome this situation.
The easiest solution is to have your view controller be a subclass of UITableViewController. This type of view controller will handle issues exactly like these.
If you cannot, you should listen to keyboard will show/hide notifications and set contentInset and scrollviewIndicatorInsets bottom of the table view to the keyboard height. Then you can scroll the specific cell into visible. When the keyboard hides, set the bottom to the previous value.
Yes....Two ways
1) either you can change the frame of whole tableView and pull the whole table up by decreasing the y position of tableView
[tableView setFrame:CGRectMake(100,100,100,100)];
or
2) You can change the contentOffset of the table to programatically scroll the tableView's last cell so that it is visible to the user.
[tableView setContentOffset:CGPointMake(0,400) animated:YES]
Hope this will help you.
I have a UIViewController in my Storyboard and in that I have a UIView which contains a UITableView.
I added another small UIView into the top of the UITableView which contains some buttons and text.
Basically, when the run the app, the UIView which I have placed in the UITableView goes to the bottom of the UITableView for some reason.... It scrolls perfectly with the UITableView, but it stays at the bottom...
How can I get the inserted UIView to stay at the top of my UITableView and still scroll with the UITableView?
Thanks, Dan.
What you're describing is the table view header. You don't add it to the table directly, but rather, you assign it to the table's tableHeaderView property like this:
self.tableView.tableHeaderView = myHeaderView;
Or you can just drag and drop a view into the storyboard at the top of the table view above the first section.