0

I need to create an application which looks similar to the iOS spring board. I need to display different profile picture arranged with rows and columns similar to the image below. Remember, I will display pictures and not applications.

SPring board I have already created a UIScrollView which display images like a spring board. first I need to make them clickable(so it would probably be buttons or images with interactions)

my main problem is that, I need to implement a behavior where I can hold/touch over an image/icon for some amount of time and move it to another location, swap it with the image where I dragged it.(Just like when your arranging your icons on a spring board)

I will need to implement this

I will need to implement this, any advice , I mean does apple have native classes for this? Or do I need to code everything for this. I already tried searching but I'm having a hard time.

Glenn S
  • 697
  • 9
  • 21
  • apple will reject your app, if it looks too much like the spring board, i.e the wiggling animation – Felix Mar 30 '12 at 10:15
  • 2
    Think perhaps you need to practice your searching skills before trying to do more development. [This](http://stackoverflow.com/questions/3703922/how-do-you-create-a-wiggle-animation-similar-to-iphone-deletion-animation) took seconds to find. – Nick Bull Mar 30 '12 at 10:32
  • The wiggle animation link that you gave me is great @NickBull , but it only animates it for wiggling and not for swapping and dragging the images. Anyway it would help me in some parts of my problem, I should just probably code the swapping. Thanks for the infos, I really appreciate it. – Glenn S Apr 02 '12 at 02:15

1 Answers1

0

iOS SpingBoard example

func startWiggling() {
    deleteButton.isHidden = false
    guard contentView.layer.animation(forKey: "wiggle") == nil else { return }
    guard contentView.layer.animation(forKey: "bounce") == nil else { return }

    let angle = 0.04

    let wiggle = CAKeyframeAnimation(keyPath: "transform.rotation.z")
    wiggle.values = [-angle, angle]
    wiggle.autoreverses = true
    wiggle.duration = randomInterval(0.1, variance: 0.025)
    wiggle.repeatCount = Float.infinity
    contentView.layer.add(wiggle, forKey: "wiggle")

    let bounce = CAKeyframeAnimation(keyPath: "transform.translation.y")
    bounce.values = [4.0, 0.0]
    bounce.autoreverses = true
    bounce.duration = randomInterval(0.12, variance: 0.025)
    bounce.repeatCount = Float.infinity
    contentView.layer.add(bounce, forKey: "bounce")
}

func stopWiggling() {
    deleteButton.isHidden = true
    contentView.layer.removeAllAnimations()
}
Beslan Tularov
  • 3,111
  • 1
  • 21
  • 34