2013-03-02 4 views
0

UICollectionViewController가 있고 이미 클릭 한/특정 이미지를 클릭하면 일반 ViewController로 '푸시'하므로 이미 이미지가 셀에 표시되어 있습니다. 어떻게해야합니까? 여기에 지금까지 ... 다른 뷰 컨트롤러에서 선택한 이미지를 열고 자 한 코드가xcode UICollection 다른보기 컨트롤러를 여는보기

-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView 
{ 
    return 1; 
} 

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 
{ 
    return [imagearray count]; 
} 

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *[email protected]"Cell" ; 
    customcell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath]; 
    [[cell nyimage]setImage:[UIImage imageNamed:[imagearray objectAtIndex:indexPath.item]]]; 
    return cell; 

} 
+0

당신이 구현해야을'collectionView : didSelectItemAtIndexPath :'와 콜렉션 뷰의 델리게이트를 설정한다. – Felix

+0

정확히 구현 된 방법은 무엇입니까? –

답변

2

당신은이 같은 대리자 메서드를 구현할 수 있습니다 도와주세요입니다 :

-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 
{ 
    DetailViewController* viewController = [[DetailViewController alloc] init]; 
    //configure detail view controller 
    // viewController.detailInfo = ... 
    [self.navigationController pushViewController:viewController animated:YES]; 
} 
+0

아이폰 포토 갤러리에서 이미지가 열렸을 때 컨트롤러의 경우 애니메이션과 같은 종류의 팝업 애니메이션을 어떻게 얻을 수 있습니까? – BaSha

+0

@BaSha 이것을 구현하려면 사용자 정의보기 컨트롤러 전환 (iOS 7 만 해당)을 사용해야합니다. – Felix

관련 문제