0

嗨,我正在尝试在 uiview 上放置一个按钮,并使该按钮具有 uiview 的大小。我试过了

button1.frame = drop3.frame; // drop3 is a uiview

但这只会使按钮跳回其原始起始位置而不改变大小。

这有点像第一次 UIGestureRecognizerStateEnded 它调整大小然后跳回原来的位置然后它工作正常?

 - (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer
    {

         CGPoint translation = [recognizer translationInView:self.view];

            recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, recognizer.view.center.y + translation.y);

         [recognizer setTranslation:CGPointMake(0, 0) inView:self.view];


        if (recognizer.state == UIGestureRecognizerStateEnded)

        {
            button1.transform = CGAffineTransformMakeScale(2,2);

        self.button1.center = drop3.center;
        }
4

0 回答 0