Hi,
i've got an UIImageView, now i want to repeat this image, that it always shows up again when scrolling left or right.
Little Example:
is this possible? it should feel like an infinite loop
Hi,
i've got an UIImageView, now i want to repeat this image, that it always shows up again when scrolling left or right.
Little Example:
is this possible? it should feel like an infinite loop
The word "infinite" rules out a UISCrollView
or a CATiledLayer
, obviously.
I'd say the easiest way to achieve this is to initialize enough UIImageView
s to completely fill your screen (or scroll area), plus one, and implement your own dragging/scrolling system and recycle the UIImageView
s as they go off one side of the screen to reappear on the other side. Because all the UIImageView
s are the same image you shouldn't ever have to worry about memory/cache management.
If you don't care about performance, you can use a "pattern image":
UIView * backgroundView = [[[UIView alloc] initWithFrame:frame] autorelease];
backgroundView.backgroundColor = [UIColor colorWithPatternImage:repeatingImage];
I think it just draws it to the view's context, though, which means it can't be "infinite" and performance might be a bit slow.