简体   繁体   中英

Getting subview location after superview rotation

I have a UIView which has several subviews that respond to touch. If I rotate the layer of the superview with some code like this:

[CATransaction begin];
[CATransaction setDisableActions:true];
view.layer.transform = CATransform3DRotate(view.layer.transform, angle, 0, 0, 1);
[CATransaction commit];

... then I can't seem to find the right location of the subviews when responding to touch events... Any ideas?

I found it, worked out beautifully I guess. I needed to convert points between UIViews for doing bezier hit testing:

-(BOOL)containsPoint:(CGPoint)point
{
    point = [self.superview.superview convertPoint:point toView:self];
    return [self.slicePath containsPoint:point];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM