views:

224

answers:

3

I want to put a scroll view inside of the table view cell. I have a number of buttons in one cell of table view and I need to scroll that cell to show the appropriate button.

A: 

I don't think you can do this. It would require nesting of scrollviews which isn't really supported.

Even if it was, it would be very difficult for a user to know which scrollview they were hitting with their pudgy finger. Remember, you don't have the one pixel precision of a mouse on the iPhone. You have an area of at least 15x15 pixels. You don't have a scroll bar but instead just drags anywhere on the screen.

Instead, you should use a master-detail pattern. Selecting the cell in the tableview pushes a detail view which has the scroll view with all the buttons.

TechZen
More curious here than anything, but how does the App Store app have a paging scrollview within a regular scrollview for a detail page of an app? Is that only because one is vertical, one is horizontal? I think it would be awkward/confusing to have the same thing in a table though.
iWasRobbed
I think the App Store is actually one scrollview and they switch the horizontal scroll on and off depending on the position of the vertical scroll. IIRC, they also dynamically center the top views.
TechZen
A: 

If you want to use a vertical scroll view then I wouldn't suggest you doing it because, as TechZen wrote, there will be a mess in this case.

If you want the inner scroll view to scroll horizontally then it might be achieved by 2 ways:

  • Implement a custom table view cell that will include a scroll view inside it.
  • Add a scroll view as a sub-view to your cell that you will return from tableView:cellForRowAtIndexPath: method.

I suggest you to use the second approach.
There are plenty of examples online. Usually the sub-views are labels or image views, but it is not complicated at all to add a scroll view instead...

Michael Kessler
A: 

why u want to doing like this.?? it think the best idea is you have to draw manually your table view above your uiscrollview, i did it, and it works, just need more effort and accuracy of draw. but it takes a lot of times.. :)

Imam Arief W