如何在应用程序中实现模仿 iPhone 默认图库的图片库?

发布于 2024-11-29 08:27:29 字数 86 浏览 0 评论 0原文

我想在我的 iPhone 应用程序中实现一个图像库,其中仅包含从应用程序内部选择的设备库中的图像或从应用程序内部拍摄的图片。请建议任何简单的方法来做到这一点。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怎言笑 2024-12-06 08:27:29

您可以尝试 Three20,它是完成此类任务的一个非常好的框架。

这是您可以使用的一些示例代码。

在界面中:

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

然后在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);

然后在buttonClick中:

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

这就是我实现此目的的方法,不要忘记为图像视图和UIImagePicker设置@property和@synthesis。

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.

撩起发的微风 2024-12-06 08:27:29

您可以将 UIScrollView 与 paging=YES 一起使用。

You can use UIScrollView with paging=YES.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文