2022. 1. 24. 16:12ㆍiOS/iOS
PhotoKit
Work with image and video assets managed by the Photos app, including those from iCloud Photos and Live Photos.
Photos 프레임워크와 PhotosUI프레임워크를 가지고 있는 프레임워크
Using PhotoKit, you can fetch and cache assets for display and playback, edit image and video content, or manage collections of assets such as albums, Moments, and Shared Albums.
PhotoKit을 사용하면 표시 및 재생을 위한 자산을 가져와 캐시하고, 이미지 및 비디오 콘텐츠를 편집하거나, 앨범, 순간 및 공유 앨범과 같은 자산 컬렉션을 관리할 수 있습니다.
fetchAssets(with: )
지정된 옵션과 일치하는 모든 자산을 가져옵니다
Retrieves all assets matching the specified options.
requestImage(for:targetSize:contentMode:options:resultHandler:)
Declaration
지정된 asset에 대한 이미지 표현을 요청합니다
Requests an image representation for the specified asset.
iOS, iPadOS, Mac Catalyst, tvOS
func requestImage(for asset: PHAsset,
targetSize: CGSize,
contentMode: PHImageContentMode,
options: PHImageRequestOptions?,
resultHandler: @escaping (UIImage?, [AnyHashable : Any]?) -> Void) -> PHImageRequestID
asset:
로드 된 이미지 데이터
The asset whose image data is to be loaded.
targetSize:
반환할 이미지의 크기
The target size of image to be returned.
contentMode:
이미지를 요청한 크기의 종횡비에 맞추는 방법에 대한 옵션
An option for how to fit the image to the aspect ratio of the requested size. For details, see PHImageContentMode.
options:
사진에서 요청을 처리하고, 요청된 이미지의 형식을 지정하고, 진행 상황이나 오류를 앱에 알리는 방법을 지정하는 옵션입니다.
Options specifying how Photos should handle the request, format the requested image, and notify your app
of progress or errors. For details, see PHImageRequestOptions.
resultHandler:
이미지 로드가 완료되면 호출되는 블록으로 요청된 이미지 또는 요청 상태에 대한 정보를 제공합니다.
A block to be called when image loading is complete, providing the requested image or information about the status of the request. The block takes the following parameters:
result: The requested image.
info: A dictionary providing information about the status of the request. See Image Result Info Keys for possible keys and values.
'iOS > iOS' 카테고리의 다른 글
iOS) multipart/form-data 이해하기 (0) | 2022.01.25 |
---|---|
iOS) splash screen, time out (feat.서버 마비) (0) | 2022.01.24 |
Concurrency(동시성)프로그래밍에 대해서4 (직렬(Serial)과 동시(Concurrent)의 차이) (0) | 2021.11.29 |
Concurrency(동시성)프로그래밍에 대해서3 (동기와 비동기의 차이) (0) | 2021.11.29 |
Concurrency(동시성)프로그래밍에 대해서2 (GCD, Operation의 개념 및 차이에 대해서) (0) | 2021.11.29 |