I have a grouped UITableViewController with one section and many rows. Each cell consists of two elements: a UILabel with a description and a UITextField for an input. A form, so to speak ;-)
Now I have a problem when I try to scroll the entire UITableViewController. Only on about half of my finger movements, it scrolls.
After I've studied the phenomenon more accurately, I noticed that the scroll works only if I hit the UILabel with my finger. If I hit the UITextField coincidentally, the UITableViewController does not scroll.
What can I do to solve the problem?
One thing you could try is to create the UITextFields with userInteractionEnabled = NO, then when the cell is selected, set userInteractionEnabled and call [textField becomeFirstResponder] on it.
Although, I have just the same kind of tables and haven't noticed any scrolling problems...and I didn't set userInteractionEnabled = NO. Have you perhaps set the cells' selection style to none? In my tables, when I tap on the row, I get a row selection. Swiping, even touching down over the text field, scrolls. But in edit mode, where I disallow row selection, if I touch down over the text field and delay just a little before swiping, I don't get a scroll, and sometimes the text field becomes first responder.
Hopefully that will give some things to think about or experiments to try.
Related
Currently I have UITableViewCell's that hold sometimes really long text (up to 50,000 pixels in height after drawing). However the UITableView delegate documentation says that cells shouldn't be higher than 2009 pixels in height (any ideas why?).
It's only the first section in my table view that has the really long cell, so instead of using a cell for the first section, I thought I'd create a UIScrollView, put a UITextView as the first "cell" and add it to the scrollView, and then add the tableView to the scroll view as well (under the textView). However, having a 50,000 px high UITextView is causing huge memory problems.
What are my options? I know I could use a UITextView that scrolls, but to have a scrollable UITextView with a tableView just causes complicated scrolling behavior. I want to mimic the scrolling of a tableView.
I didn't know it would be an issue to have a 50,000 px high view in a UIScrollView. I thought that's what UIScrollView's are for? Do I have any alternatives?
I would seriously question the UI design where you must render text that large as part of a table cell. The best option would be to put a reasonably-sized summary in a cell with cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;, build a separate view for the long text, and let the user navigate to that view by clicking the disclosure indicator.
As a side note, you could also put a scroll view inside the initial table cell (not all cells must be of the same type; you can make one with a scroll view in it, and use it for the cell at index zero). It's not going to be as usable as the regular cell with a disclosure indicator, though.
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 am creating a table view cell with a text view inside and my problem is that I do not want the text view to scroll when it becomes first responder.
I have set scrollEnabledto NO and that avoids scrolling most of the time. But when the text view is completely filled up with text (I do not allow the user to enter more text than the text view can contain without scrolling) it scrolls up a bit when it becomes first responder.
How can that be avoided? :/
Thanks a lot,
Stine
You can determine where the text view will scroll to when it becomes first responder by setting the selected range.
Setting it like this:
[textView setSelectedRange:NSMakeRange(0, 0)];
will keep the text view scrolled to the top.
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
I have a UITableView with custom cells. The cells containing one UITextView each and the cell is resizing during user type text in the TextView. My problem is when user is on first row in a TextView autocorrection bubbles wont be visible in the current cell. Is there any workaround or can someone point me to another direction?
alt text http://img340.imageshack.us/img340/5414/skrmavbild20100519kl092.png
If the cell is resizing as the user types, you could set the minimum height of the edited cell to have enough height for the bubbles. Always measure the active cell as if there were at least two lines.
Each UIView has a clipsToBounds property that controls wether contents can be drawn outside the bounds. You might be able to set this to NO for all views in the hierarchy between the bubble and cell. This could have other side effects though.
Also, make sure the active cell has a higher Z order than neighboring cells. It could simply be that the next cell down is drawing over the bubble, as opposed to the active cell cropping the bubble.
I propose you a "workaround"
Your user try to edit a row in your table view
-> You present a modal view with a UITextView with dismiss and ok button.