我每次尝试拖动时都会移动一个按钮,然后每次点击时移动一个segue。对于拖拽,我已经使用了这个方法:
string input = "1234 - description (moreInfo)";
string pattern = "\\d+\\s*-([^\\(]+)";
Regex rgx = new Regex(pattern);
Match match = rgx.Match(input);
if (match.Success) {
Console.WriteLine(match.Groups[1].Value);
}
正在调用哪个但它不会移动。我还需要放置或调用什么?
答案 0 :(得分:0)
我认为这对你有用:
var panGesture: UIPanGestureRecognizer = UIPanGestureRecognizer(target: self, action: Selector("recognizePanGesture:"))
panGesture.minimumNumberOfTouches = 1
panGesture.maximumNumberOfTouches = 1
buttonView.addGestureRecognizer(panGesture)
func recognizePanGesture(sender: UIPanGestureRecognizer)
{
var translate = sender.translationInView(self.view)
sender.view!.center = CGPoint(x:sender.view!.center.x + translate.x,
y:sender.view!.center.y + translate.y)
sender.setTranslation(CGPointZero, inView: self.view)
}