UITableView footer appearing in middle of screen because of keyboard - iphone

I have added a custom footer to a tableview using viewForFooterInSection
I display a alertprompt where I get user input via a UITextField so the keyboard appears but when I press OK and the screen refreshes (via statement[self.tableView reloadData];)
my footer is displaying ABOVE where the keyboard used to be so displaying in the middle of my tableview instead of at the bottom of the screen.
How do I get the keyboard to disappear BEFORE the footer redraws so I don't have the footer in the middle of the screen??

According to Text and Web Programming for iPhone OS: Managing the Keyboard: Moving Content That Is Located Under the Keyboard:
Note: As of iOS 3.0, the UITableViewController class automatically resizes and repositions its table view when there is in-line editing of text fields. See “View Controllers and Navigation-Based Applications” in Table View Programming Guide for iOS.
It sounds like the table view responds to the keyboard appearing/disappearing regardless of whether the text field is inside the table view. File a bug. If you make your own UIViewController subclass which manages its own table view, you can probably work around the bug.
You're also slightly misled: reloadData doesn't "redraw the footer".

Related

Swift iOS Scrolling View When Keyboard Is Visible

In my view I have two text fields and one text view. The text fields aren't hidden by the keyboard but the text view is. No problem. I can scroll it. The issue I'm having is that if the keyboard is already visible the keyboardWillBeShown event doesn't occur. My text view is visible enough to be tapped on when the keyboard is up but I want the entire field to scroll into view. Since keyboardWillBeShown won't fire (since the keyboard is already shown) how can I scroll the field?
I figured it out. Just had to add the scrolling code to the begin editing event.

View with uitableview, tabbar and more objects

I'm developing an app and I need a view with these elements:
- UITableView
- UITextField and UIButton
- TabBar
As you can guess, I am developing a chat, but when I put the elements in the .xib, I can't show de layer: UITextField and UIButton. If I put them without a view, they dont appear.
If I put a view under the table, and in that view I put the text and the button I get this error: http://pastebin.com/CKfxijz9 (I put the error there because it's to long)
Thanks in advance
There are some ways of dealing with that, depending on how it should behave. Some of them are:
Provide a table footer or header view that holds the button and
the text field.
Nest the table view into another view. The table
view and the view containing the button and text fielt are on the
same level within the view hierarchy. They are rather siblings than
sub- and superview to each other.
Use a UISlider instead of a table. (However, I personally would use the table.)
Here's an approach I've used in the past (not sure if it's best practice, but it works).
Add your button and textfield to a new view (let's call it, bottomView)
Add bottomView to the superview of your tableview
Set the frame of your bottom view so that it fits to the bottom of the screen (this will make it so your tableview will scroll, but keep your bottomView always attached to the bottom of your mainview)

iPhone Keyboard Adjust In View

I've been searching, but haven't quite found a complete answer, and the Apple docs aren't much help.
I have an application with a UIView that has a lot of text fields on it, ranging from the top of the view to the bottom. When the user clicks the first UITextField the keyboard pops up. The keyboard has three buttons above it, previous, next, and done on a toolbar InputAccessoryView.
Basically, let's say there are 6 UITextField boxes that space from the top of the view to the bottom. When the user gets past the third text field, the keyboard blocks the bottom three. How do I have the view adjust up when putting text in the bottom three text fields?
You need to place your textfields into a UIScrollView, and either translate the view above the keyboard when it is active and away when it is down, or another solution such as always having the keyboard up on that page, which'll save you the setFrame calls on your UIView/UIScrollView depending on what the keyboard is doing.
This will further help:
How to adjust the view position when the keyboard opens in iPhone?

Iphone custom cell keyboard overlaps

i have a TableView with custom cells that i have built with Interface Builder.
Inside the cell, i have a label and a text field. But when i click on the text field to write, the keyboard overlaps the text field and i can't see what i am writing.
How can i avoid this?
Thanks
You have to resize the view containing the tableview when keyboard is shown. The way you can do is discussed here,
How to make a UITextField move up when keyboard is present?
You can search in Stackoverflow more on 'iphone keyboard hides textview'.
after resizing view, you can scroll table to the current cell too.

Manually scrolling UITableViewController when a UITextField becomes first responder

Harrr pirates!
I'm trying to make a data entry screen using a UITableViewController. It contains a grouped table view with two sections, each with a few (2 and 4) rows with a UITextField inside them.
When any of the UITextFields become first responder they scroll into view automatically. Great, you would say, but I want to scroll the whole section into view, not just the row containing the UITextField that became first responder.
I don't allow the user to scroll the UITableView by hand and I know to what position it should scroll to display correctly. However, I can't get my UITableViewController to stop automatically scrolling the UITextField into view for me.
Searching StackOverflow I can find a lot of questions about how to resize the UITableView when the keyboard appears, but this doesn't stop the automatic scrolling.
Any suggestions? Your help would be much appreciated!
TableView is basically an extension of scrollView therefore if you want to do the scroll yourself you should use the scrollview API.
Set the contectSize property to the size of the screen without the keyboard and the contentOffset to the location on the table you want to scroll to