打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
PHLivePhoto
Inherits From
NSObject
PHLivePhoto
Conforms To
NSCopying
NSObject
NSSecureCoding
Import Statement
OBJECTIVE-C
@import Photos;
Availability
Available in iOS 9.1 and later
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.
NOTE
For guidance on how to integrate Live Photos with your app’s user experience, see Live Photos in iOS Human Interface Guidelines.
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.)
Inspecting a Live Photo
size Property
Loading a Live Photo from Data Files
+ requestLivePhotoWithResourceFileURLs:placeholderImage:targetSize:contentMode:resultHandler:
+ cancelLivePhotoRequestWithRequestID:
Data Types
PHLivePhotoRequestID
Constants
Image Request Identifiers
Result Handler Info Dictionary Keys
2:PHLivePhotoRequestOptions
Inherits From
NSObject
PHLivePhotoRequestOptions
Conforms To
NSCopying
NSObject
Import Statement
OBJECTIVE-C
@import Photos;
Availability
Available in iOS 9.1 and later
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.
Specifying Image Request Options
deliveryMode Property
Fetching Image Data from iCloud
networkAccessAllowed Property
progressHandler Property
3:PHLivePhotoView
Inherits From
NSObject
UIResponder
UIView
PHLivePhotoView
Conforms To
NSCoding
NSObject
UIAppearance
UIAppearanceContainer
UICoordinateSpace
UIDynamicItem
UIFocusEnvironment
UITraitEnvironment
Import Statement
OBJECTIVE-C
@import PhotosUI;
Availability
Available in iOS 9.1 and later
A 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.
NOTE
For guidance on how to integrate Live Photos with your app’s user experience, see Live Photos in iOS Human Interface Guidelines.
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.
Choosing a Live Photo to Display
livePhoto Property
Managing Playback
playbackGestureRecognizer Property
muted Property
Responding to Playback Events
delegate Property
Manually Playing Live Photo Content
- startPlaybackWithStyle:
- stopPlayback
Accessing User Interface Icons for Live Photos
+ livePhotoBadgeImageWithOptions:
Constants
PHLivePhotoViewPlaybackStyle
PHLivePhotoBadgeOptions
4:PHLivePhotoViewDelegate
Inherits From
NSObject
Conforms To
Not Applicable
Import Statement
OBJECTIVE-C
@import PhotosUI;
Availability
Available in iOS 9.1 and later
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.
Responding to Live Photo Playback Events
- livePhotoView:willBeginPlaybackWithStyle:
- livePhotoView:didEndPlaybackWithStyle:
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
轻松拍出如丝般畅滑的水流—iOS11 长曝光功能初体验
苹果低调的用心设计?8个iOS10的升级彪悍功能
iOS 11 的 Bug 这么多,库克怎么看?| 附解决办法
纳尼?超好用的iOS 11技巧
擦出新火花!iPhone 6S與iOS 9的十大新功能
看完这篇,刷新你对iPhone相机的认知
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服