UIButton根据scrollview中的缩放级别移动

时间:2013-01-01 00:58:18

标签: ios uiscrollview uibutton

我正在以编程方式将自定义UIButton添加到显示地图的scrollView。当我完全放大坐标是正确的。我一缩小它们就会四处移动。有没有办法解决/补救这个?我现在正在设置它们:

- (void)createButtonFrom:(aClass* )class
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchUpInside];
    button.tag = class.number;
    button.frame = CGRectMake(class.xValue, class.yValue, 50, 50);
    [scrollView addSubview: button];
}

然后在viewDidLoad中我调用:

[self createButtonFrom:Test];
编辑:我可能应该更好地解释一下。我不想要一个静态按钮。我希望按钮移动并缩放,以便它保持在我的地图上覆盖相同区域的相同位置。现在它在更改zoomScale时会偶尔移动。

0 个答案:

没有答案