How to implement an image gallery inside an application mimicking the iPhone's default gallery?

ε祈祈猫儿з 提交于 2019-12-05 17:37:10
Nipin Varma

You can try Three20, it's a very nice framework for doing such a task.

Here is some piece of sample code you can use.

In interface :

//IBOutlet UIImageView *image;
UIImagePickerController *imgPicker;
IBOutlet UIImageView *imageview;

Then in viewDidLoad :

self.imgPicker = [[UIImagePickerController alloc] init];
self.imgPicker.allowsImageEditing = YES;
//self.imgPicker.delegate = self;
self.imgPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
//imgarry = [[NSArray alloc]initWithObjects:@"terms.png",@"change-profile.png",nil];
UIImage* img = [UIImage imageNamed:@""];
UIImageWriteToSavedPhotosAlbum(img,nil,nil,nil);

Then in buttonClick :

UIImagePickerController *picker = [[UIImagePickerController alloc]init];
imgPicker.delegate = self;
imgPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:imgPicker animated:YES];
[imgPicker release];

This is how i achieve this, don't forget to set @property and @synthesis for image-view and UIImagePicker.

You can use UIScrollView with paging=YES.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!