【发布时间】:2011-07-14 13:26:45
【问题描述】:
我创建了一个UIButton *actionbtn,它的默认图像是1.png,高光图像是2.png,我选择这个按钮,并将它移动到屏幕的任何地方。我的代码是
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint touchMoved = [touch locationInView:self];
actionbtn.frame = CGRectMake(touchMoved.x-40, touchMoved.y-40, 80, 80);
}
如果我点击按钮并移动它,它不能移动,但如果我触摸屏幕,并在屏幕上移动,按钮可以工作......
【问题讨论】: