2

I am programmatically adding a custom UIButton to a scrollView which displays a map. When I'm fully zoomed in the coordinates are correct. As soon as I zoom out they move around. Is there any way to fix/remedy this? I'm currently setting them up like this:

- (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];
}

Then in viewDidLoad I call:

[self createButtonFrom:Test];

EDIT: I probably should have explained better. I don't want a static button. I want the button to move around and scale so that it remains in the same location on my map covering the same area. Right now it moves sporadically around when changing the zoomScale.

4

0 回答 0