質問

State when non-expanded <code>uiscrollview</code>

State when expanded <code>uiscrollview</code>

I want to create an expandable uiscrollview like the images shown above. I've tried to search with keywords but cannot find any example similar to what I want to achieve.

I wonder if I should use uiscrollview or uitableview?

Any advice would be much appreciated.

Thank you in advance.

役に立ちましたか?

解決

You can create a UITableView then rotate it 90 degrees counter clock wise and it will work like a charm.

Just create a UITableView subclass (i.r. HorizontalUITableView) and in the initWithFrame, rotate the view 90 degrees:

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.transform = CGAffineTransformMakeRotation(-M_PI/2.0);
        self.showsVerticalScrollIndicator = NO;
    }
    return self;
}

You will also need to subclass your UITableViewCell's and rotate them 90 degrees too

他のヒント

Assuming I'm interpreting your images correctly, I'd suggest you first create a UIView subclass that represents one of those stacks. It will need to manage a list of items/images, and be able to animate between the expanded/collapsed modes. Then create a UIScrollView subclass to manage a set of these stacks, and have it animate the layout of the stacks based on the current size of each stack as they expand/collapse.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top