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.
Related
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.
I have 2 cells in a group in a tableview, the first has a textview in it, (2 lines max). When the user selects the textview, the keyboard appears and moves the textview up from under the keyboard. the second cell only appears when the textview has focus.
However the second cell is still hidden by the keyboard, I have tried to the various methods that scroll the tableview, but the result is always jerky, with the table moving up and down rapidly. Probably because its inserting a row, scrolling up for the keyboard and me trying to make it scroll up even more all at once.
How can I prevent the keyboard from moving scrolling the table view at all, so that I can do the scrolling myself exactly how I want it, and avoid the ugly fight between the two methods.
Did you try this method by setting scroll position to UITableViewScrollPositionTop ,if this not work ,just make your second cell that with textfield :)
- (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated
Use a UITableViewController instead a UIViewController (for the ViewController where your UITableView is placed). That will solve the scrolling issue.
If not possible, you have to scroll by your self (pain in the ass).
See: Making a UITableView scroll when text field is selected
I have the following problem: I have a standard UITextView which I resize once the keyboard pops up. I also have another view which I animate into view (not the standard accessory view attached to the keyboard). The problem is that I do not want text to be hidden by this view. This is what happens when I reach the last line (orange view = my custom accessory view):
Ideally, I'd like to have an automatic scroll should that happen. But I have no clue how to achieve this if I am in the last line of the UITextView. Also, scrollToVisible doesn't work in this context and I don't know if I'd get anywhere with contentInset.
Any suggestions would be welcome! Thanks.
EDIT
I suppose I would need some kind of mechanism which would allow to
make the textview only expand to the line right above the accessory view if I was entering something on the LAST LINE
have the textview expand to the keyboard if I was not editing the LINE DIRECTLY ABOVE the KEYBOARD.
Does that make sense? What I need is the opposite of contentInset, I suppose.
I simply don't want to resize the textView to just above the accessory view as it takes away screen space to display text.
I got the solution- sorry, I guess it was obvious, but it took me the whole day to figure it out:
textOfPage.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
This will offset my UITextView so that the last line is never hidden. The 100 is in pixels and can be adjusted accordingly.
What I would do is resize the textview in the textViewShouldBeginEditing method to fit above the keyboard and the newly added accessory view, and then resize it back to full screen when the keyboard is dismissed in textViewShouldEndEditing
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?
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".