IPhone, how to implement a "wide" UITableViewCell?

I would like to have a UITableView with cells over 320 points. The user must be able to scroll sideways to be able to view different parts of the UITableViewCell. Is this possible with a UITableView, or should I go and try to implement UIScrollView tiling?

I tried wrapping a UITableView in a UIScrollView, and the results are terrible - they compete for scroll gestures and scroll wins most of the time, preventing the table from moving vertically.

Any input is appreciated!

Thanks!

Update: I tried the proposed solution and it scrolls correctly, but the view table is still only 320 pixels wide. Is the width of the View table related to the borders of the window?

+4
source share
1 answer

Scrolling around a table view with scrolling is the right way.

UIScrollView with

  • Show horizontal scrollers
  • scrolling enabled
  • autosave in full screen

Inside this UITableView

  • shows vertical scrollers
  • scrolling enabled

Then I set the table view frame, with w, being the estimated width of the table view with all the columns, regardless of your width, and kTableScrollViewHeight is the fixed height of both the table view and the scroll view in my case, for example 367 points (screen minus status, navbar and tab):

 tv.frame = CGRectMake(0, 0, w, kTableScrollViewHeight); 

and scroll content size

 scrollView.contentSize = CGSizeMake(w, kTableScrollViewHeight); 

If you need to scroll behavior to the top level when the user deletes the status bar, you can set

 scrollView.scrollsToTop = NO; 

otherwise, the scroll view will remove the tap from the table view.

+1
source

Source: https://habr.com/ru/post/1387065/


All Articles