I have a parent viewcontroller , and there have a subview(UIView).
The subview(named xibSubView) is called other custom class(xib) file.
When I click on the parent Viewcontroller, the subview(UIView) will motion to touch began position on the parent viewcontroller.
The parent viewcontroller have
// UIViewcontroller.h file
.....
@property (weak, nonatomic) IBOutlet XibSubView *xibSubView;
.....
The below code is in the parent viewcontroller .m
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
self.subViewConstraint.constant = touchLeftScreenPoint.x ;
self.subViewConstraint.constant = touchLeftScreenPoint.y ;
}
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
}
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
}
And the xib(subview-xibSubView) code have the same delegate method.
// The code is in the parent viewcontroller .m
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
}
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
}
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
}
In the xibSubView have much elements.
One of the elements will motion to the click position in the subview(xibSubView).
So I want to pass the parent viewcontroller touches into xibSubView.
And manual call the touchBegan in the xibSubView let the element motion.
So I should transform the parent viewcontroller touches position to subview touches position.
The subview touches x position and y position will subtract the viewcontroller width and height and manual call the touchbegan method.
But I don't know how to changed the touches x, y values restore to touches.
Then call the code:
[self.xibSubView touchesBegan:touches withEvent:event];
How can I change the NSSet touches x,y variable and restore to touches.
Thank you very much.