I would like to code a shelf and I don’t want to think about resizing and changing background images on a rotation and depending on the screensize (iPad/iPhone). Is it possible to create an image, that would stretch horizontally but repeat vertically?
By now, I’ve only found the [UIColor colorWithPatternImage:] and [UIImage strechableImageWithLeftCapWidth:topCapHeight:] or the new [UIImage resizableImageWithCapInsets:]. But I didn’t manage to let them work together, obviously.
I hope the illustration helps understanding my issue:

Do you have any idea how to accomplish the above, so that it will work with a single image for different sizes and orientations? Thanks!
[UIColor colorWithPatternImage:]can take up an extreme amount of memory when working with a large number of rows. I ended up creating a single image view that was one row larger than the entire view using[UIColor colorWithPatternImage:], then offset that view up or down a row as necessary when the view was about to scroll offscreen. Since the view is only moved at row boundaries, the performance was much better than I expected.However, a better option would be to create a pool of individual
UImageViewsusing[UIColor colorWithPatternImage:]and tile them, similar to whatUITableViewdoes will table view cells.Apple has sample code which illustrates this technique in the ScrollView Suite sample project and the Designing Apps with Scroll Views video from WWDC 2010.