2017-02-10 7 views
0

ユーザーがタップすると画像をフルスクリーンで表示したい。 誰も私を助けることができますか? My ImageViewはTableViewCellにあります。ここで は、私が試したものです:iOSプログラミングユーザーがImageViewをタップしたときにイメージのフルスクリーンを表示する方法


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
    ImageListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; 
    cell.propertyImageView.frame = [UIScreen mainScreen].bounds; 
    cell.propertyImageView.image = [imageList objectAtIndex:indexPath.row]; 
} 
+0

チェック:http://stackoverflow.com/a/21260074/4831524 –

+1

コードにフルスクリーンイメージを表示するコードが含まれていません。どのようにフルスクリーンイメージを表示したいですか?テーブルビューの上のレイヤー、または新しいビューコントローラー? – Raptor

+0

はい、テーブルビューのトップレイヤーにあります。ありがとうございます!手伝ってくれませんか? –

答えて

0

それは、このような非常に簡単です:このようなあなたのテーブルのデリゲートから

-(void)removeImage { 

    UIImageView *imgView = (UIImageView*)[self.view viewWithTag:100]; 
    [imgView removeFromSuperview]; 
} 

-(void)addImageViewWithImage:(UIImage*)image { 

    UIImageView *imgView = [[UIImageView alloc] initWithFrame:self.view.frame]; 
    imgView.contentMode = UIViewContentModeScaleAspectFit; 
    imgView.backgroundColor = [UIColor blackColor]; 
    imgView.image = image; 
    imgView.tag = 100; 
    UITapGestureRecognizer *dismissTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(removeImage)]; 
    dismissTap.numberOfTapsRequired = 1; 
    [imgView addGestureRecognizer:dismissTap]; 
    [self.view addSubview:imgView]; 
} 

コール:これはANS

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 

    [self addImageViewWithImage:[imageList objectAtIndex:indexPath.row]]; 
    } 
関連する問題