I am trying to understand if something like this is possible and if yes how can i go about achieving this.
i want to create a UIView that it is a container for other views that respond based on the below picture. i know that a UIView is a container of other UIViews. what i want to be able to do is to be able to touch on a UIImageView and when i am dragging it in the main View, if it gets out of bounds on one side, to be shown on exactly the opposite direction like shown on the image. i hope i managed to explain the question correctly.
Click Here for the Description
I am trying to understand if something like this is possible and if yes
Share
You can achieve that very easily by implementing the container
UIView‘s touch methods:- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)eventIn
touchesMovedyou can check for yourUIImageView‘s origin. If it crosses the boundaries (x,yless than 0 or bigger than the container’s dimensions) then simply reposition its frame by your desired offset.