分享

PHLivePhoto

 wintelsui 2015-12-22

PHLivePhoto

A Live Photo is a picture, captured by the Camera app on a supported device, that includes motion and sound from the moments just before and after it was taken. A PHLivePhoto object represents the combined photo, motion, and sound data that produces such a picture. Use this class to reference Live Photos from the user’s library (fetched with the PHAsset and PHImageManager classes), to load displayable Live Photo objects from data obtained elsewhere (such as pictures shared through a social network), and to assign Live Photos to PHLivePhotoView objects for display.

The PHLivePhoto class serves in much the same role for Live Photos as the UIImage class serves for static images. A UIImage object represents not the data file an image is loaded from, but instead a ready-to-use image that can be displayed in a view—similarly, a PHLivePhoto object represents a Live Photo ready to display with motion and sound using a PHLivePhotoView object, not an entry in the Photos library or the data resources that constitute a Live Photo. (To work with Live Photos as elements of the Photos library, use the PHAsset class. To work with the data files that constitute a Live Photo, use the PHAssetResource class.)

2:

PHLivePhotoRequestOptions

You use a PHLivePhotoRequestOptions object to specify options when requesting Live Photo representations of photo assets from a PHImageManager object. A Live Photo is a picture that includes movement and sound from the moments just before and after its capture.

3:

PHLivePhotoView

PHLivePhotoView object is a view that displays a Live Photo—a picture that also includes motion and sound from the moments just before and after its capture. After obtaining a PHLivePhoto object (either from the Photos library using the UIImagePickerController or PHAsset and PHImageManager classes, or by creating one from asset resources exported from a Photos library), use a Live Photo view to display the photo and control playback of its motion and sound content.

By default, a Live Photo view uses its own gesture recognizer to allow the user to play the motion and sound content of a Live Photo with the same interactions and visual effects seen in the Photos app. To customize this gesture recognizer—for example, to install it on a different view for proper event handling in your app’s view hierarchy—use the playbackGestureRecognizer property.

Typically, an app does not need to directly control Live Photo playback. In some situations, however, it can be useful to briefly animate the view to indicate to the user that a picture is a Live Photo. To do this, use the startPlaybackWithStyle: method with the PHLivePhotoViewPlaybackStyleHint option.

4:

PHLivePhotoViewDelegate

The PHLivePhotoViewDelegate protocol describes messages sent by a PHLivePhotoView instance in response to playback events when playing the motion and sound content associated with a Live Photo. To receive these messages, implement the methods in this protocol in one of your controller objects and assign that object to the delegate property of a Live Photo view.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多