1

For example: Collection view have four images,The user touches any cell mean its want to go to another view controller.give some idea for me friends. enter image description here

Take this image as example if the user click the chrome image means it go to another view controller.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Kishore kumar
  • 143
  • 1
  • 14

2 Answers2

2

Create new UIButton, then use setImage method on it to set the image. Leave the title empty.

Enrico Susatyo
  • 19,372
  • 18
  • 95
  • 156
0

use this code for objc:

-(void)viewDidLoad {

UIImageView *imageview = [[UIImageView alloc]initWithFrame:CGRectMake(100.0, 100.0, 100.0, 100.0)];
[imageview setImage:[UIImage imageNamed:@"image.png"]];
[imageview setUserInteractionEnabled:YES];

UITapGestureRecognizer *singleTap =  [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapping:)];
[singleTap setNumberOfTapsRequired:1];
[imageview addGestureRecognizer:singleTap];

[self.view addSubview:imageview];
}
SinaMN75
  • 6,742
  • 5
  • 28
  • 56