开发者

iPhone SDK - drag only 1 thing at a time

This seems quite complicated to me, and I cannot get it to work. Basically what I want to do, is I have created 9 objects on the开发者_StackOverflow中文版 screen, and I want to be able to drag all of them, but I only want to be able to drag one at a time. Eg, drag item 1, stop dragging item 1. Drag item 3, stop dragging item 3. Drag item 2, stop dragging item 2. I will put the 'VERY' simplified code below, but it will probably be pretty much useless, I just don't want to put all my code in, as it is very badly written at the moment, and doesn't make much sense.

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

}

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

self.center = CGPointMake(pos.x+difference.x, pos.y+difference.y);

}

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

}


Set exclusiveTouch to YES for all 9 view objects. Then it will cause only one view to be touched at a time.

See the reference

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜