像辅助触摸一样移动按钮

Moving button like assistive touch

你好,我想在我的应用程序中移动一个 uibutton,就像我们在 iphone 中有辅助触摸一样,同样我想要在我的应用程序中使用那种按钮..是否可以这样做如果是这样,请帮助提供代码是一些链接

这个问题被问了很多次....这里是答案

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

        UITouch *touch = [[event allTouches] anyObject];
        CGPoint touchLocation = [touch locationInView:self.view];
        button.frame.x = touchlocation.x;
        button.frame.y = touchlocation.y;
    }