0

I've seen many solutions out here but they're not exactly what I'm looking for. What I'm attempting to do is have the view's background to move an image multiple times-- slowly and diagonally rather than horizontally or vertically.

From a web designing perspective, this can be achieved with a tiled bg.gif where the image gives the effect of an image moving without additional programming.

Example:

enter image description here

However, I'm not sure whether this is achievable within Swift programming. I'm sure alternative solutions are out there like having a single image (a smiley face) tiled to fill the view frame and have it move diagonally by incrementing it's x & y coordinates.

I'm new to iOS development and Swift yet I am learning a lot! Much help will be appreciated.

Uyghur Lives Matter
  • 18,820
  • 42
  • 108
  • 144
theflarenet
  • 642
  • 2
  • 13
  • 27

1 Answers1

0

refer this two links. it will help to achieve what you want. click here and click here

Update as advised in comment : download SwiftGif and Import the Gif.swift in your project and do the following:

// Returns an animated UIImage
let myGif = UIImage.gifWithName("imggif")

// Use the UIImage in your UIImageView
let imageView = UIImageView(image: myGif)

here imggif is your gif image which shown in question. put it in your project

hope this will help :)

Community
  • 1
  • 1
Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
  • Oikay. Updating my answer. :) – Ketan Parmar Apr 17 '16 at 18:59
  • Awesome find! I'll try this in a few hours but I'm curious whether this or my other idea of incrementing x & y coordinates is more efficient? Probably a single gif... if so, I'll have to design my own gif with the image moving at a speed and direction desired with the right cropping so it looks seamless when tiled. – theflarenet Apr 18 '16 at 03:19