cell clipsToBounds set to Yes, so viewing outside the cell anchor will not be visible
The following method will help you get the image in the cell full screen, and then return it to the same place.
You need to add gestureRecognizer to imageView and set selector as cellImageTapped
Declare UIImageView * temptumb, fullview; as an instance variable.
- (void)cellImageTapped:(UIGestureRecognizer *)gestureRecognizer { NSLog(@"%@", [gestureRecognizer view]); //create new image temptumb=(UIImageView *)gestureRecognizer.view; //temptumb=thumbnail; fullview=[[UIImageView alloc]init]; [fullview setContentMode:UIViewContentModeScaleAspectFit]; fullview.image = [(UIImageView *)gestureRecognizer.view image]; CGRect point=[self.view convertRect:gestureRecognizer.view.bounds fromView:gestureRecognizer.view]; [fullview setFrame:point]; [self.view addSubview:fullview]; [UIView animateWithDuration:0.5 animations:^{ [fullview setFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; }]; UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(fullimagetapped:)]; singleTap.numberOfTapsRequired = 1; singleTap.numberOfTouchesRequired = 1; [fullview addGestureRecognizer:singleTap]; [fullview setUserInteractionEnabled:YES]; } - (void)fullimagetapped:(UIGestureRecognizer *)gestureRecognizer { CGRect point=[self.view convertRect:temptumb.bounds fromView:temptumb]; gestureRecognizer.view.backgroundColor=[UIColor clearColor]; [UIView animateWithDuration:0.5 animations:^{ [(UIImageView *)gestureRecognizer.view setFrame:point]; }]; [self performSelector:@selector(animationDone:) withObject:[gestureRecognizer view] afterDelay:0.4]; } -(void)animationDone:(UIView *)view { [fullview removeFromSuperview]; fullview=nil; }
source share