Frente a algunas dificultades implementando draggableVer. utilizando monotouch, pero no "creo que sea específico del idioma ... los detalles del problema: Tengo una vista que maneja TouchesBegan, TouchesMove y se reposiciona (cambiando la propiedad Frame). Que funcione perfecto! una vez que estoy agregando ScrollView con el desplazamiento y la paginación deshabilitados, cualquier toque realizado en la vista de desplazamiento no llega a la Vista que tiene que moverse. Al establecer la interacción del usuario en NO se solucionan los problemas de movimiento, pero ninguno de los controles alojados dentro del controlizador responde a ningún toque.
¿Alguna idea sobre cómo tener ScrollView y permitirle a su supervisión ver todos los toques cuando no hay eventos de desplazamiento disponibles?
Respuestas
1 para la respuesta № 1Tienes que pasar el toque a las subvistas, esta categoría para UIScrollView
hará el trabajo
@implementation UIScrollView (FixedApi)
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
NSLog(@"touch view = %@", [[touch view].class description]);
if ([[[touch view].class description] isEqualToString:@"UITableView"]) {
//You have touched a UITableView
} else if ([[[touch view].class description] isEqualToString:@"UIView"]) {
//You have touched a UIView
} else {
//Ignore the category and return the touch to the UIScrollView.
[self.superview touchesBegan:touches withEvent:event]; // or 1 nextResponder, depends
[super touchesBegan:touches withEvent:event];
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if ( !self.dragging ) [self.nextResponder.nextResponder touchesEnded:touches withEvent:event];
[super touchesEnded:touches withEvent:event];
}
@end
0 para la respuesta № 2
Puedes arrastrar la subvista usando PanGesture Action ...
-(void)panGRAction {
if (panGR.state == UIGestureRecognizerStateBegan) {
UITouch *touch = [[event allTouches] anyObject];
NSLog(@"touch view = %@", [[touch view].class description]);
if ([[[touch view].class description] isEqualToString:@"UITableView"]) {
//You have touched a UITableView
} else if ([[[touch view].class description] isEqualToString:@"UIView"]) {
//You have touched a UIView
} else {
//Ignore the category and return the touch to the UIScrollView.
[self.superview touchesBegan:touches withEvent:event]; // or 1 nextResponder, depends
[super touchesBegan:touches withEvent:event];
}
} else if (panGR.state == UIGestureRecognizerStateEnded) {
if ( !self.dragging ) [self.nextResponder.nextResponder touchesEnded:touches withEvent:event];
[super touchesEnded:touches withEvent:event];
}
}