in ViewController.h
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface ViewController : UIViewController <UINavigationControllerDelegate,UIImagePickerControllerDelegate,UIGestureRecognizerDelegate>
@property (strong, nonatomic) IBOutlet UIImageView *imageView1;
@property (strong, nonatomic) IBOutlet UIImageView *imageView2;
@property (strong, nonatomic) IBOutlet UIImageView *imageView3;
@property (strong, nonatomic) IBOutlet UIImageView *imageView4;
@property (strong, nonatomic) IBOutlet UIImageView *imageView5;
@end
ViewController.m
#import "ViewController.h"
@interface ViewController()
{
UIImageView *imageviewPick;
}
@end
@implementation ViewController
@synthesize imageView1,imageView2,imageView3,imageView4,imageView5;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
imageView1.layer.cornerRadius = self.imageView1.frame.size.height/2;
imageView1.layer.borderWidth = 1.0f;
imageView1.layer.borderColor = [[UIColor grayColor] CGColor];
imageView1.layer.masksToBounds = YES;
imageView2.layer.cornerRadius = self.imageView2.frame.size.height/2;
imageView2.layer.borderWidth = 1.0f;
imageView2.layer.borderColor = [[UIColor grayColor] CGColor];
imageView2.layer.masksToBounds = YES;
imageView3.layer.cornerRadius = self.imageView3.frame.size.height/2;
imageView3.layer.borderWidth = 1.0f;
imageView3.layer.borderColor = [[UIColor grayColor] CGColor];
imageView3.layer.masksToBounds = YES;
imageView4.layer.cornerRadius = self.imageView4.frame.size.height/2;
imageView4.layer.borderWidth = 1.0f;
imageView4.layer.borderColor = [[UIColor grayColor] CGColor];
imageView4.layer.masksToBounds = YES;
imageView5.layer.cornerRadius = self.imageView5.frame.size.height/2;
imageView5.layer.borderWidth = 1.0f;
imageView5.layer.borderColor = [[UIColor grayColor] CGColor];
imageView5.layer.masksToBounds = YES;
UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapImageOne:)];
tap1.numberOfTapsRequired = 1;
UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapImageTwo:)];
tap2.numberOfTapsRequired = 1;
UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapImageThree:)];
tap3.numberOfTapsRequired = 1;
UITapGestureRecognizer *tap4 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapImageFour:)];
tap4.numberOfTapsRequired = 1;
UITapGestureRecognizer *tap5 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapImageFive:)];
tap4.numberOfTapsRequired = 1;
imageView1.userInteractionEnabled = YES;
imageView2.userInteractionEnabled = YES;
imageView3.userInteractionEnabled = YES;
imageView4.userInteractionEnabled = YES;
imageView5.userInteractionEnabled = YES;
[imageView1 addGestureRecognizer:tap1];
[imageView2 addGestureRecognizer:tap2];
[imageView3 addGestureRecognizer:tap3];
[imageView4 addGestureRecognizer:tap4];
[imageView5 addGestureRecognizer:tap5];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)tapImageOne:(UIGestureRecognizer *)tapGesture
{
imageviewPick = (UIImageView *)tapGesture.view;
[self showGallery];
}
-(void)tapImageTwo:(UIGestureRecognizer *)tapGesture
{
imageviewPick = (UIImageView *)tapGesture.view;
[self showGallery];
}
-(void)tapImageThree:(UIGestureRecognizer *)tapGesture
{
imageviewPick = (UIImageView *)tapGesture.view;
[self showGallery];
}
-(void)tapImageFour:(UIGestureRecognizer *)tapGesture
{
imageviewPick = (UIImageView *)tapGesture.view;
[self showGallery];
}
-(void)tapImageFive:(UIGestureRecognizer *)tapGesture
{
imageviewPick = (UIImageView *)tapGesture.view;
[self showGallery];
}
-(void)showGallery
{
UIImagePickerController *pickImage = [[UIImagePickerController alloc]init];
pickImage.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
pickImage.delegate = self;
[self presentViewController:pickImage animated:YES completion:nil];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
imageviewPick.image = image;
[picker dismissViewControllerAnimated:YES completion:nil];
}
@end
Zeig mir deine Codierung bis jetzt, was Sie versucht? – user3182143
Sind zirkuläre Bilder in tableView oder View? – user3182143
Bitte sehen Sie das Template Image im geven link –