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];
}
}
精彩评论