jueves, 25 de agosto de 2016

iOS: View ignoring touches but the ones inside its subviews



The "Request product button" was inside "Container view" so I was either unable to click on it or unable to scroll the collection view below the "Container view"

Solution:

Subclass UIView and assign that subclass class to "Container view" and implement the following:

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
    UIView *hitView = [super hitTest:point withEvent:event];
    if (hitView == self) return nil;
    return hitView;

}

[super hitTest:point withEvent:event] will return the view touched that is the deepest in the view hierarchy.

No hay comentarios:

Publicar un comentario