Pregunta

The project I'm currently working requires that a UIScrollView to scroll vertically and horizontally, however, it must only bounce vertically. Is this possible? I noticed that there is a verticalBouncing and horizontalBouncing property in the declaration, could that be the answer?

¿Fue útil?

Solución

You cannot access @package ivars directly. However, you can register yourself as delegate of UIScrollView and implemenet this code

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    float maxX = scrollView.contentSize.width - scrollView.frame.size.width;

    CGPoint offset = scrollView.contentOffset;
    offset.x = MAX(MIN(maxX, offset.x), 0);
    scrollView.contentOffset = offset;
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top