【发布时间】:2016-04-16 16:27:38
【问题描述】:
我有以下ViewController 课程,我正在尝试显示实时照片。我不确定如何真正让图像显示在处理 UIImageView 时我会写这样的东西:
let image = UIImage(imageNamed: "someStringPointingToImage") //then add this to the image view.
但是有人知道它如何与我添加到资产中的实时图像一起使用吗?
功能
import UIKit
import Photos;
import PhotosUI
import MobileCoreServices
class ViewController: UIViewController, PHLivePhotoViewDelegate {
var livePhotoIsAnimating = Bool()
override func viewDidLoad() {
super.viewDidLoad()
self.livePhotoView()
}
//MARK: Create the Live Photoview
func livePhotoView() {
let photoView: PHLivePhotoView = PHLivePhotoView.init(frame: self.view.bounds)
//%%%%%%% Area to add the image %%%%%%
photoView.contentMode = .ScaleAspectFill
self.view.addSubview(photoView)
self.view.sendSubviewToBack(photoView)
}
func livePhotoView(livePhotoView: PHLivePhotoView, willBeginPlaybackWithStyle playbackStyle: PHLivePhotoViewPlaybackStyle) {
self.livePhotoIsAnimating = true
}
func livePhotoView(livePhotoView: PHLivePhotoView, didEndPlaybackWithStyle playbackStyle: PHLivePhotoViewPlaybackStyle) {
self.livePhotoIsAnimating = false
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
谢谢。
【问题讨论】:
-
如果在资产中,只需使用其名称...
-
直播是什么意思?
标签: ios swift phlivephoto