【问题标题】:Is there any sample for ALAssetsLibrary有没有 ALAssetsLibrary 的样本
【发布时间】:2010-09-01 12:42:07
【问题描述】:

对于 iPhone 4,很多 API 不能再使用了。

我正在寻找 UIImageWriteToSavedPhotosAlbum 的替代解决方案。

ALAssetsLibrary 是 Apple 在新 iOS 4 中的当前解决方案。

谁有这方面的经验,可以提供一些示例或开源项目?

谢谢

【问题讨论】:

    标签: ios4


    【解决方案1】:

    你需要做这样的事情 -

    ALAssetsLibrary* library=[[ALAssetsLibrary alloc] init] ; 
    // Request to save the image to camera roll
    [library writeImageToSavedPhotosAlbum:img.CGImage orientation:(ALAssetOrientation)img.imageOrientation 
        completionBlock:^(NSURL* assetURL, NSError* error) {
            if (error != NULL)
                // Show error message...
            else  // No errors
                // Show message image successfully saved
        }] ;
    

    虽然我很想弄清楚如何让这段代码与 iphone 3 SDK 兼容。

    【讨论】:

    • Ahhh.. 也想通了,只是弱链接 AssetsLibrary.framework
    • 谢谢!我想我得到了答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-10
    • 2014-02-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多