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.
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.
Try Three20 or AQGridView.
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