开发者

How to display documents as grid of icons?

开发者 https://www.devze.com 2023-02-06 13:56 出处:网络
What\'s the best way to let an iPad user browse a documents folder, with documents displayed as a grid of icons with captions? (Like the events view in iPhoto, but with files and folders in place of e

What's the best way to let an iPad user browse a documents folder, with documents displayed as a grid of icons with captions? (Like the events view in iPhoto, but with files and folders in place of event开发者_StackOverflow社区s.)


There is no built-in control for this sort of UI. You could either use something like AQGridView (on GitHub) or build your own by subclassing UIScrollView.


or you build it yourself like this:

-(void)createGrid
{
    int col = 0;
    int row = 0;
    for (int i = 0; i<12; i++)
    {
        col = i % 2;
        row = i / 2;
        self.gridItem = [[ItemViewController alloc] init];
        [self.gridItem.view setTag:i];
        [self.scrollView addSubview:self.gridItem.view];
        [self.gridItem.view setFrame:CGRectMake(col*160, row*160, 160, 160)];
        [self addChildViewController:(UIViewController*) self.gridItem];
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消