PHImageManager获取全尺寸图像

时间:2016-06-17 08:29:08

标签: ios swift cocoa-touch

我有这个功能从资产中获取图像:

func fetchImage(asset: PhotoAsset, size: CGSize, resizeMode: ResizeMode = .Exact, completion: (result: UIImage?) -> Void) {
        let photoAsset = asset as! PHAsset
        var options: PHImageRequestOptions?
        switch resizeMode {
            case .Exact:
                options = PHImageRequestOptions()
                options?.resizeMode = .Exact
            case .Default:
                options = nil
        }
        manager.requestImageForAsset(
            photoAsset,
            targetSize: size,
            contentMode: .AspectFill,
            options: options
        ) { [weak self] result, _ in
            completion(result: result)
        }
    }

但我如何定义以获取原始大小的图像?

谢谢!

1 个答案:

答案 0 :(得分:12)

... .then((response: ng.IHttpPromiseCallbackArg<IWordRow>): any => { self.word = angular.copy(response.data); self['wordNgForm'].$setPristine(); // <== ... }, 用于targetSize:

PHImageManagerMaximumSize