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

喜欢而已 提交于 2019-12-07 09:51:36

问题


I want to implement an image gallery inside my iPhone app which will only have those images from device gallery that have been either selected from inside the app or pictures taken from inside the app. Please advice on any simple methods to do so.


回答1:


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.




回答2:


Try Three20 or AQGridView.




回答3:


You can use UIScrollView with paging=YES.



来源:https://stackoverflow.com/questions/7035589/how-to-implement-an-image-gallery-inside-an-application-mimicking-the-iphones-d

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