This is the hierarchy:
-- ViewController.View P [width: 375, height: 667]
---- UIImageView A [width: 375, height: 667]
[A is holding an image of size(1287,1662)]
---- UIImageView B [width: 100, height: 100]
[B is holding an image of size(2400,982)]
Note: B is not a subview of A. In the app, B is draggable. And I am trying to merge two A and B where positions are, A [background] and B [foreground].
I want to find the exact position of B such that, after merging it will be at the same position where I dragged & dropped.
- I have written all the code for drag and drop.
- I couldn't find a proper position of B for merging with A.
Here are the problem screenshots:
Showing the initial position of B.
This is the new position of B after drag and drop.
Wrong position of B after merging.
Any help would be appreciated.
Thanks in advance.
Attention! : Attached images Sample Later and a Signature inside the screenshots has been founded in Google search. I have used for demonstration purpose only.
I needed to use imageView's (A) frame.size instead of A.image.size to get the right location while merging.
Here's the code:
You can consider it as a suggestion:
Because the imageView's size is different from the original image ,instead of merging two images via two view's ABSOLUTE position , you can use a RELATIVE position.
Sudo-code :