How can we horizontally scroll tableview in iPhone SDK? - iphone

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

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.

UITableView limit scrolling speed OR UITableView limit number of rows to be scrolled

I just saw a brilliant application Nimbuzz. In its chat window, when there are couple of messages and we scroll the UITableView, what appears to be is, scrolling speed is slow. It may sound weird what I just said. You may also consider it this way. On scrolling the table, not much rows are scrolled in comparison to usual scroll behavior.
I am creating an application where I need the similar feature. How to do that?
I think you do that with scrollview's decelerationRate property. Since tableview is subview of scrollview it would work.

Display lines of data with horizontal and vertical scrolling iOS

I wish to display a dynamic set of data (pulled live over a TCP connection) on the iPhone that is not too unlike lines from a terminal.
This means that the lines will be very long and really cannot be wrapped.
What is the best way of accomplishing this?
I want to use a UITableView because then memory issues would be less of a concern because the lines of text would be loaded/unloaded automatically each line of text would be a cell.
I have thought about this a bit and I came up with a possible solution, but I am not sure if it would actually work.
I could put a UITableView in a UIScrollView and only let the containing UIScrollView scroll horizontally.
Then I would adjust the frame of the UITableView and UITableViewCells so that they are much wider as calculated by the longest line of text.
I have read that you really don't want to nest a UITableView in a UIScrollView since UITableView is in fact a subclass of UIScrollView. Since UITableView is a subclass of UIScrollView, is there someway I can enable the horizontal scrolling and make the frame wider?
If either of those ideas would actually work, could you also tell me which properties I should change (frame or contentSize etc).
I ended up putting a UILabel in a UIScrollView and just kept an array of all the lines and made the UILabel the minimum necessary width and height.
I then set the number of lines of the UILabel to the number of elements in the array. This works because there is no textwrapping.
I think this should be fine performance wise, but we'll see.
You can see it in action in my app Adminium for Bukkit/Minecraft:

Recreate UIPickerView with just one row showing

I need a "PickerView", that behaves like a normal UIPickerView, but only shows one row of data and has a custom design.
Something like you see in the image, showing the transition from subview 1 to subview 2. After the user lifts his finger and after the scrolling stops, only one subview will be shown:
IMAGE
So basically a scrollview which:
is endless in both, positive and negative directions by showing the same entries over and over
uses paging across several subviews
only shows one subview when not scrolling, and no more than two subviews when scrolling.
I can get a endless scrollview to work, but not with paging enabled. Paging will always limit my scrolling to the next subview.
So I'm thinking about creating my own UIView subclass which custom scrolling behaviour to mimic a UIPickerView. But before doing so, I wanted to get some opinions about the idea in general. Is creating a custom UIView the right way to go? Anyone has some experience with the expected performace? (There will be timers to handle the scrolling algorithm, which has to be recreated of course... :)
Another approach would be to subclass UIScrolView and implement the paging myself. I know when the scrollView starts decelerating
, so maybe there is a way to overwrite the contentOffset to have it scroll into the right position...?!
Any help is appreciated! Thanks!
Here is a great custom component, which seems to be able to do everything you need:
http://dev.doukasd.com/2011/04/infinite-scrolling-dial-control-for-ios/
It's not endless, but rather a modified UITableView with a huge number of cells.
Would it be feasible to just use a UIPickerView, but clipped to the middle row? You could turn off showsSelectionIndicator to remove the overlay and have the delegate pass back custom row views.

UITableView as a UIScrollView

I've been working with a UIScrollView and have about 200 items to scroll through...so far. This doesn't work since it takes around 45 seconds to load all of the views. I've tried loading the first 20 (about 4 seconds) on the main thread then load in blocks of 50 on other threads. I get the first 20 to scroll through but the others don't appear.
It's taken lots of effort just to get the UIScrollView to work properly and there are still some issues. The UITableView will solve all of this for me since it reuses cells. It's similar to the UIScrollView except more efficient.
I'd like to have one cell take up the entire viewing area and have the user flick through each cell. Rather than freely scrolling through cells, scrolling will stop at each cell and the user must flick again for the next cell. The UITableView doesn't do this that I know of. Is there a way to get this behavior with a UITableView?
UITableView is a subclass of UIScrollView. Have you tried simply setting yourTableView.pagingEnabled = YES?
Short answer: no.
You can try to control UITableView's scrolling behavior using the delegate methods, or better yet, stick with UIScrollView and load the views one-by-one in the UIScrollViewDelegate methods.