我正在使用 AQGridView 创建一个包含大约 21 个项目的图片库。我想在此列表/滚动视图的顶部添加一个包含应用程序徽标和名称的视图,以便用户看到它,但当他们滚动查看图像时,带有名称和徽标的视图会随之滚动。以前有没有人实施过这样的事情?
感谢@skram,我能够添加徽标,但现在图像被第一行图像挡住了。
这是我定义徽标并将其添加到 gridView 的地方:
self.gridView = [[AQGridView alloc] initWithFrame:CGRectMake(0, 0, 320, 367)];
UIImageView *logo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"paramythLogoTest.png"]];
[logo setFrame:CGRectMake(0,0,logo.frame.size.width,logo.frame.size.height)];
[gridView addSubview:logo];
self.gridView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.gridView.autoresizesSubviews = YES;
self.gridView.delegate = self;
self.gridView.dataSource = self;
[self.view addSubview:gridView];
[self.gridView reloadData];
然后在此处加载图像:
- (AQGridViewCell *) gridView: (AQGridView *) aGridView cellForItemAtIndex: (NSUInteger) index
{
static NSString * PlainCellIdentifier = @"PlainCellIdentifier";
GridViewCell * cell = (GridViewCell *)[aGridView dequeueReusableCellWithIdentifier:@"PlainCellIdentifier"];
if ( cell == nil )
{
cell = [[GridViewCell alloc] initWithFrame: CGRectMake(3.333, 3.333, 100, 100)
reuseIdentifier: PlainCellIdentifier];
}
NSString *stringURL = [[featuredStories objectAtIndex:index] objectAtIndex:1];
NSURL *url = [NSURL URLWithString:stringURL];
[cell.imageView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"example0.png"]];
cell.storyID = [[featuredStories objectAtIndex:index] objectAtIndex:0];\
return cell;
}
这是模拟器的截图: