0

I have a view as follows

Parent View

The colored tiles are basically views. When i long press on the tiled views i am creating a copy of the tile in which it was long pressed. Also when it is long pressed there should be a view as per the following image.

enter image description here

The drop area should come up from bottom part or it should grow from bottom insect of the screen.

When long pressing on the tiled view i am creating a copy of the view and i am able to make the copy successfully and drag on the screen, but i am stuck at creation of this drop area and its animation.

Can someone guide me how to implement this....

Thanks in advance...

LC 웃
  • 18,888
  • 9
  • 57
  • 72
Jobins John
  • 1,265
  • 23
  • 45
  • you're not able to code the drop area? or what's the problem exacty? – Mohamad Bachir Sidani Aug 03 '17 at 10:51
  • to implement the drop area to have a growing effect you should do 3 things in animation code, first increase its width to entire screen, reduce the y coordinate to bring the view up on the screen, and finally add to the current hieght so that it covers bottom area of your screen. – Rishabh Aug 03 '17 at 10:52
  • @MohammadBashirSidani I am not able to generate the drop area programmatically. Thats where i am stuck. – Jobins John Aug 03 '17 at 10:53

1 Answers1

0
    let dropView = UIView(frame: CGRect(x:0, y:0, width:300, height:100))
    dropView.frame.origin = CGPoint(x: 0, y: self.view.frame.size.height)
    dropView.center = CGPoint(x:self.view.frame.size.width/2, y:dropView.center.y)
    dropView.backgroundColor = UIColor.blue
    self.view.addSubview(dropView)

When you want to animate it to show up use this:

    UIView.animate(withDuration: 0.5, delay: 0.0, options: [.repeat, .curveEaseOut, .autoreverse], animations: {
        dropView.frame.origin = CGPoint(x:dropView.frame.origin.x, y:dropView.frame.origin.y - dropView.frame.size.width - 10)
    }, completion: nil)
Mohamad Bachir Sidani
  • 2,077
  • 1
  • 11
  • 17