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...

3
  • you're not able to code the drop area? or what's the problem exacty? Commented Aug 3, 2017 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
    Commented Aug 3, 2017 at 10:52
  • @MohammadBashirSidani I am not able to generate the drop area programmatically. Thats where i am stuck. Commented Aug 3, 2017 at 10:53

1 Answer 1

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.