AQGridView를 사용하여 약 21 개의 항목이있는 이미지 갤러리를 만듭니다. 사용자가 볼 수 있도록이 목록/scrollview 상단에 앱 로고와 이름이 포함 된보기를 추가하고 싶지만 이미지를 보면서 스크롤하면 이름과 로고 스크롤이있는보기가 표시됩니다. 이전에 이와 비슷한 것을 구현 한 사람이 있습니까?AQGridView의 위쪽에보기 추가 ScrollView
@skram 덕분에 로고를 추가 할 수 있었지만 이제 이미지는 이미지의 첫 번째 행을 차단합니다.
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;
}
시뮬레이터의 스크린 샷이다 나는 로고를 정의하고있는 gridview에 추가 할 경우 여기에
입니다
좋습니다. 작동하지만 이미지가 겹쳐서 표시됩니다. 오프셋을 설정해야하는 위치를 알고 있습니까? – mkral
'insertSubview : belowSubview'를 사용할 수 있습니다. 이 작업은 레이어의 첫 번째 객체로 로고를 추가하는 것입니다. 나머지는 위의 레이어에 추가됩니다 :'[_grid insertSubview : logo belowSubview : (UIImageView *) [_ grid.subviews objectAtIndex : 0]]; 그것이'UIImageView'라고 가정합니다. – skram
나는 당신의 예제에서 약간 혼란 스럽습니다. 같은 로고 이미지 뷰 아래에 로고 imageview를 삽입하는 것을 말하지 않습니까? – mkral