prevent tableview from scrolling while scrolling inside a tableviewcell - iphone

i've got a tableview. inside this, i have a tableviewcell with a horizontal scrollview inside it.
it works fine, but if i start scrolling horizontal inside a tableviewcell and move a bit up or down, the horizontal scrolling stops and the tableview gets scrolled.
is there a way to prevent the tableview from scrolling while scrolling horizontal inside a tableviewcell?
thanks for all help

try scrollView.canCancelContentTouches = NO
If that doesn't work you may have to do more complicated handling of touch events by subclassing UIScrollView. (Look at touchesBegan:event:, touchesMoved:event:, touchesEnded:event:, touchesCancelled:event:)

you should not put the UIScrollView inside an UITableView. you could show the content of your cell vertically Or show on the details view
UITableView is a subclass of UIScrollView.
Form Apple Documentation.
Important: You should not embed
UIWebView or UITableView objects in
UIScrollView objects. If you do so,
unexpected behavior can result because
touch events for the two objects can
be mixed up and wrongly handled.
More

Related

uitableview inside a uiscrollview (scrolling issue)

I have got a uitableview inside of a uiscrollview.
So the uitableview is smaller than the uiscrollview. And when I start to scroll down on the uitableview and it reaches the bottom, I am able to scroll in the uiscrollview.
And it works fairly. But not perfectly.
I would like to make the ux perfect so the scrollview would be kind of an extension (or another section of the uitableview). I don't want to add any section or footerview at the bottom of the tableview.
I was wondering on doing this by implementing something like this:
//
if tableview didscroll to bottom
then scrollview scrolltorect xxx
//
but it would only work if the uitableview was scrolling down.
I am not sure if this would replicate the correct ux behaviour.
Could you guys give me your advice on how to do this?
Thank you and best regards.
I found this very hard and difficult to execute so I changed my UI in order to put the bottom of the interface inside the tableview footer's view. This way the experience of scrolling my app got much smoother.

Implementing a dynamic height on UITableView

I have a UITableView embedded in a UIViewController. The TableViewCells are rows for the user to select something, so when they touch it a checkmark appears, heres where my question comes in:
I dont want the UITableView to scroll in its window, I want the TableView to grow with the items it contains. Do I need to put a scroll view on the UIViewController and then the TableView on that? Or will the ViewController scroll if the content is bigger than the View?
Also, Im not even sure where to start with changing the height dynamically of the UITableView, everywhere I look its about changing the cell heighets dynamically.
Please Help! Thank you!
self.tableView.scrollEnabled=false;
stops the scrolling
self.tableView.frame=CGRectMake(0, 0, (float)width, (float)height);
sets the size of your tableview
But I don't understand why you want to stop tableview scrolling and to scroll the whole view....

Custom cell in UITableView

I am making a custom cell which has text fields and as a result the custom cell is greater than the size of the iphone screen.But i am not being able to do horizontal scroll to reach the end of the cell.
I have tried using viewController and adding table view to it as well as creating table view controller and adding custom cell to it.
when doing it through TableViewController,I am not able to horizontally scroll it,whereas i am not getting how to add Custom cell class to the tableView object placed in viewController.I know that UITableView is a subclass of UIScrollView but not able to implement it.Please help.
Thanks
as per the documentation at
A table view in the UIKit framework is limited to a single column
because it is designed for a device with a small screen. UITableView
is a subclass of UIScrollView, which allows users to scroll through
the table, although UITableView allows vertical scrolling only.
so as desired in your case you will have to take some other approach. Now using Custom cell with TextFields should not actually need you to require Horizonatl scrolling. If the text is really large you would like to consider using TextView instead of TextFields.
Hope it helps
Ideally, you should be truncating your text. But if it is important for you to display the entire text, add a scroll view as a subview (or set it as the content view) and add your labels to the subview. Each cell will then be individually horizontally scrollable.

How can we horizontally scroll tableview in iPhone SDK?

I want to scrolltableview horizontally as well as vertically. How can I do it?
I'd suggest making a UIScrollView the same size as the screen and then making your UITableView bigger than the screen.Drop the TableView into the ScrollView. Set up the scrollview with a high contenSize.width and then tweak it to work as you desire.
The idea with embedding UITableView into UIScrollView seems to be great, however there is a serious gotcha. UITableView is optimized to display only visible viewpoirt area and limiting allocated UITableView cells. In the case it is embedded into UIScrollView, it allocates complete content area of scroll view, i.e. all rows for the UITableView. It goes out of the memory for approximatelly 2000 rows. Since the UITableView.reloadData creates callback in main thread, it blocks main thread to respond to didReceiveMemoryWarning and application is killed on system sole discretion for level 2 warning, which is never received.
It seems that the better way is in subclassing UITableView and extending rows to width which can be scrolled horizontally.
If you are looking for something similar to what is done in 'Pulse', then this tutorial might help you:
http://iosstuff.wordpress.com/2011/06/29/creating-pulse-style-scrolling-horizontally-scrolling-uitableview-as-a-subview-of-uitableviewcell/
It shows how to add a horizontally scrolling UITableView to a vertically scrolling UITableView

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