Tile image in UIImageView and move offset in code

I need to get tiled image in UIImageView with next conditions:

  1. Image size will be just the same as screen
  2. I need to scroll the image to the left/right in code (animation or gesture)
  3. When scrolling, I need to get infinite background

I assuming that I need make image tiling, but how to affect something like offset?

imageView.image = image.resizableImage(withCapInsets: .zero, resizingMode: .tile)


It can be any solution, absolutely not going to be a UIImageView.

That seems the right way to do it:

https://stackoverflow.com/questions/1125230/tiled-background-image-can-i-do-that-easily-with-uiimageview


You asked: but how to affect something like offset?

offset to what for what ?

Offset like in any scroll view. Here is the example of moving tiled image in Photoshop to be clear.


https://vimeo.com/405376793https://vimeo.com/405376793


I can create tiled background, but cannot figure out how to scroll it.

I cannot find any properties or methods to modify tiling offsets or pattern phase unless using Core Graphics directly.

You may need to create your own subclass of UIView and draw the image as you want, instead of using UIImageView.

Very likely Photoshop may not be using UIImageView.

It’s example to show behavior of tiled image I need. I don’t say Photoshop use Cocoa or Swift. It’s reply for Claude31 to explain what I mean by offset of tiling images.

So, you do not need UIImageView for your purpose.

So, do you know the solution or specific advice?))) Did you have such experience?

Please clarify if you need UIImageView or not, and you can add a reply to my first comment.

Funny enough. Those who try to help have to justify their experience ? 😁😉

Clarifying:

  1. I need tiled background with repetitive seamless image
  2. I need to somehow set "offset" (actually the point from which image will start drawing or will be moved to that amount, it's going to imitate infinite background scroll)
  3. No matter it will be UIImageView or not. (Maybe it can be done with UIView extension or any other solution. I just cannot find any solution here that will not be overcomplicated). So, any real advice is highly appreciated.

If "So, you do not need UIImageView for your purpose." was final clear advice that describes the solution and I just misunderstood, then I am really sorry for additional question)))

Tile image in UIImageView and move offset in code
 
 
Q