0

我正在做一个有 pin drop 功能的模块。pin[Image view] 被放置在可缩放的滚动视图上。缩放时,图像视图根据其中心原点移动。

我想让它随着它的底部移动。

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale;
{
    zoomLevel=scale;
    for (SSSmartPinView *smartPinView in smartPinViewMutArray) {
        smartPinView.zoomScale = zoomLevel;
        smartPinView.parrentOffset = drawingScrollView.contentOffset;
        smartPinView.center = CGPointMake(([smartPinView.coresmartPin.xpoint floatValue]*zoomLevel),(([smartPinView.coresmartPin.ypoint floatValue]+(zoomLevel))*zoomLevel));



    }


}
- (void)scrollViewDidZoom:(UIScrollView *)scrollView{
    zoomLevel=scrollView.zoomScale;
    for (SSSmartPinView *smartPinView in smartPinViewMutArray){
        smartPinView.zoomScale = zoomLevel;
        smartPinView.parrentOffset = drawingScrollView.contentOffset;

      smartPinView.center = CGPointMake(([smartPinView.coresmartPin.xpoint floatValue]*zoomLevel),(([smartPinView.coresmartPin.ypoint floatValue]+(zoomLevel))*zoomLevel));


    }
}
4

1 回答 1

1

您可以使用设置锚点(旋转/缩放的中心点)

smartPinView.layer.anchorPoint = CGPointMake(0.5, 1.0);

查看anchorPoint属性

于 2013-07-01T19:16:39.917 回答