然而,我是在Peterdev。 如果我对另一个机构有两点看法,那么请告诉我,如果我点击超级看法,那就会拖拉,当我点击分观点时,就会拖拉。 谁能帮助我?
我的守则是:
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *aTouch = [touches anyObject];
//UITouch *aTouchSuper = [touches anyObject];
CGPoint location = [aTouch locationInView:self.view];
//CGPoint locationSuper=[aTouchSuper locationInView:viewForTouch];
[UIView beginAnimations:@"Dragging A DraggableView" context:nil];
////////////////////////
//if(location.x>50 &&location.x<300 ){
// viewForTouch.frame = CGRectMake(location.x,0,
// viewForTouch.frame.size.width, viewForTouch.frame.size.height);
//
//
//
// }
UIView *subview = [self.view hitTest:[[touches anyObject] locationInView:self.view] withEvent:nil];
NSLog(@"%i",subview.tag);
if (location.x <= 50)
{
location.x = 50;
}
if (location.x >= 300)
{
location.x = 300;
}
if(subview.tag==12){
viewForTouchInner.frame = CGRectMake(location.x,0,
viewForTouchInner.frame.size.width, viewForTouchInner.frame.size.height);
}
if(subview.tag==11)
{
viewForTouch.frame = CGRectMake(location.x,0,
viewForTouch.frame.size.width, viewForTouch.frame.size.height);
}
///////////////////////
//if(viewForTouchInner.hidden=FALSE){
//
//
//
//
// location.x=0;
// NSLog(@"%f",location.x);
// viewForTouchInner.frame = CGRectMake(location.x,0,
//
// viewForTouch.frame.size.width, viewForTouch.frame.size.height);
//
//
// }
[UIView commitAnimations];
[buttonForMove addTarget:self action:@selector(Show) forControlEvents:UIControlEventTouchUpInside];
}