2016-11-03 10 views
0

내 애플 리케이션의 JSON UICollectionView 섹션이 있습니다. 코드에 대한 나의 독창적 인 아이디어가 변경되었으므로 이제 전체 줌 제스처 컨트롤로 '라이트 박스'스타일의 효과로 전체 이미지로 표시되도록 이미지를 선택하기 만하면됩니다.UICollectionView를 통해 탭에 전체 화면 이미지보기

내 컬렉션보기에서 제스처 또는 다른 방법을 사용하여 코드를 가져 오는 데 문제가 있습니다.

-(NSInteger)collectionView:(UICollectionView *)collectionView  numberOfItemsInSection:(NSInteger)section 
{ 
    return myObject.count; 
} 

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView 
       cellForItemAtIndexPath:(NSIndexPath *)indexPath 
{ 

    CustomColumnCell *myCell = [collectionView 
           dequeueReusableCellWithReuseIdentifier:@"myCell" 
           forIndexPath:indexPath]; 

    NSDictionary *tmpDict = [myObject objectAtIndex:indexPath.row]; 

    NSURL *url = [NSURL URLWithString:[tmpDict objectForKey:path]]; 
    NSData *data = [NSData dataWithContentsOfURL:url]; 
    UIImage *img = [[UIImage alloc] initWithData:data]; 

    myCell.displayImage.image = img; 
    myCell.displayDetail.text= [tmpDict objectForKey:name]; 

    return myCell; 
} 

가 어떻게 단순히 이미지의 전체 화면보기 탭을 사용할 수 있습니까 : 여기

은 뷰 생성의 조각인가? 나는 새로운 뷰 컨트롤러에서 그것을 얻을 수 있지만, 필자가 필요로하는 것은 이미지가 주 화면쪽으로 움직여서 가로 세로 비율로 채워지는 '라이트 박스'스타일 효과뿐입니다.

아래 코드는 간단한보기 컨트롤러를 생성하는 항목을 어떻게 클릭 할 수 있는지 보여줍니다. 하지만 같은 화면에서 전체 화면으로 지나치게 오버레이 된 화면이 필요합니다.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    if ([[segue identifier] isEqualToString:@"showDetail"]) { 

     NSIndexPath *IndexPath = [[self.collectionView indexPathsForSelectedItems] objectAtIndex:0]; 
     NSDictionary *tmpDict = [myObject objectAtIndex:IndexPath.row]; 

     [[segue destinationViewController] setImageItem:[tmpDict objectForKey:path]]; 
     [[segue destinationViewController] setDetailItem:[tmpDict objectForKey:name]]; 

    } 
} 

누구나 아이디어가 있습니까? 당신이 애니메이션 선택한 이미지를 검색하려면

답변

0

을 구현하기 위해이 라이브러리를 통해 이동합니다.

// Create image info 
    JTSImageInfo *imageInfo = [[JTSImageInfo alloc] init]; 
    imageInfo.imageURL = [NSURL URLWithString:[[self.attachments objectAtIndex:indexPath.row] valueForKey:@"attach_file"]]; 
    imageInfo.referenceRect = self.frame; 
    imageInfo.referenceView = self.superview; 

    // Setup view controller 
    JTSImageViewController *imageViewer = [[JTSImageViewController alloc] 
              initWithImageInfo:imageInfo 
              mode:JTSImageViewControllerMode_Image 
              backgroundStyle:JTSImageViewControllerBackgroundOption_Blurred]; 

    // Present the view controller. 
    [imageViewer showFromViewController:self transition:JTSImageViewControllerTransition_FromOriginalPosition]; 

도움이되기를 바랍니다.

+0

감사합니다.하지만 어떻게 연결합니까? – user6934446

+0

UIImageView에 제스처를 추가하고이 이미지 뷰를 클릭하면이 코드를 작성할 수 있습니다. 하지만이 코드는 viewcontroller에서 호출해야하므로 하나의 델리게이트 메서드를 만들고이 코드로 호출하는 것이 좋습니다. –