IPhone horizontal scrolling

I need to create a view on an iPhone that scrolls horizontally through the image gallery. The problem is that this gallery can have from 100 to 1000 images that must be submitted, so I would like them to not load them into a single UIScrollView right away and not destroy performance. I need to create a view that processes view objects (like a UITableView) in order to increase performance and reduce memory overhead, but I need to scroll them horizontally.

Any ideas? Is it possible to do a UITableView operation horizontally?

Thanks!

+7
iphone uitableview uiscrollview horizontal-scrolling
source share
6 answers

You can use the large scroll bar and control the change in scroll position. You can add images as sub-items when they enter the actual viewing area, and delete them as you scroll.

Thus, you should have a small number of representations of images at any given time, but you can see that they are all there.

You can even process images by changing their image and location so as not to create or destroy complex objects. This is what a UITableView does with cells.

+1
source share

It is as simple as appiling transform.

Here is the code. Write this to your tableViewController init:

self.view.frame = CGRectMake(100,-5,250,350); //any Frame of your choice CGAffineTransform trans = self.view.transform; // get current transform (ie portrait) trans = CGAffineTransformRotate(trans, (M_PI / -2.0)); // rotate 90 degrees to go landscape self.view.transform = trans; // set current transform (landscape) 

But now you need to understand that your axis is also replaced. Any changes you make at height will change the width (and vice versa) and any changes made to the beginning. X changes the value of origin.y (and vice versa)

+2
source share

I agree with mbmcavoy , you can also watch iPhone / iPad - AppStore, for example UIScrollView with paging and preview This article explains what you need in UIScrollView, and also gives a good example and source code.

Hi

0
source share

Is it possible to add a UITableView horizontally? In a different orientation than the screen. Then you can use the regular semantics of the UITableView, where each row is an image that scrolls horizontally rather than vertically.

0
source share

Sending a response to this old thread because the confirmed answer is incorrect. You can use the UITableViewController and its built-in functions dequeueReusableCellWithIdentifier.

The trick is to make your table look and then rotate your cage in the opposite direction.

in viewDidLoad you add:

 self.view.transform = CGAffineTransformMakeRotation(-M_PI_2); 

And then in cellForRowAtIndexPath you will use:

 cell.containerView.transform = CGAffineTransformMakeRotation(M_PI_2); 

Make sure that every content in your cell is added to the container view (in this example, containerView), so you only need to rotate the container and not every item in the subcategory.

Also note that it will work better with square sized cells, otherwise you may run into height / width calculation.

0
source share

I think I have an answer for you. About scrolling UITableView Horizontally:

  • create a UIScrollView (and disable vertical scrolling)
  • enter a UITableView inside the scroll view
  • change the width of the table as you wish and update UIScrollView.contentSize as tableView width
-one
source share

All Articles