小编Sam*_*rns的帖子

如何在arkit上添加黑白过滤器(swift4)

我想做的就是采用基本的arkit视图并将其转换为黑白视图.现在基本视图是正常的,我不知道如何添加过滤器.理想情况下,在截取屏幕截图时,黑白过滤器会添加到屏幕截图中.

import UIKit
import SceneKit
import ARKit

class ViewController: UIViewController, ARSCNViewDelegate {

    @IBOutlet var sceneView: ARSCNView!

    override func viewDidLoad() {
        super.viewDidLoad()
        sceneView.delegate = self
        sceneView.showsStatistics = true
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        let configuration = ARWorldTrackingConfiguration()
        sceneView.session.run(configuration)
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        sceneView.session.pause()
    }

    @IBAction func changeTextColour(){
        let snapShot = self.augmentedRealityView.snapshot()
        UIImageWriteToSavedPhotosAlbum(snapShot, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil)
    }
}
Run Code Online (Sandbox Code Playgroud)

filter ios scenekit swift4 arkit

4
推荐指数
2
解决办法
1598
查看次数

如何在UIView上插入图像?

下面的代码在UIView上打印一行.我只想知道我要编写的代码,以便能够在视图顶部插入图像.

import UIKit

class draw: UIView {
    var line = UIBezierPath()
    var line1 = UIBezierPath()

    func grapher() {
        line1.move(to: .init(x:0, y: bounds.height / 6))
        line1.addLine(to: .init(x: bounds.width, y: bounds.height / 6))
        UIColor.blue.setStroke()
        line1.lineWidth = 2
        line1.stroke()
    }

    override func draw(_ rect: CGRect) {
        grapher()
    }
}
Run Code Online (Sandbox Code Playgroud)

image uiview ios swift

2
推荐指数
2
解决办法
9026
查看次数

标签 统计

ios ×2

arkit ×1

filter ×1

image ×1

scenekit ×1

swift ×1

swift4 ×1

uiview ×1