I'm trying to do a horizontal scroll of UILabels with different widths.
I've already put all labels next to开发者_运维技巧 each other inside the UIScrollView, but since the page scrolling, bouncing and snapping is done in scrollview.frame.width "steps", i cannot set it to work as I'd wish.
Can this be done? Thank you so much :)
What happens if you set the size of your width property to be the width of the next label? Something like (in your scroll view delegate) :
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
    // Get the label that's going to slide into view
    UIView *label = [self getCurrentLabel];
    // Get it's width
    float width = [label frame].size.width;
    // Set our size
    CGRect frame = [scrollView frame];
    frame.size.width = width;
    [scrollView setFrame:frame];
}
PS I've not tried this so it might just fail horribly!
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论