我正在使用iOS 11的大标题导航栏,但是当我添加一个条形按钮项时,它看起来很奇怪,位于与原始标题导航栏相同的位置.我想在标题很大时向下移动条形按钮项目,并在导航栏不再大时将其移回原始位置.这样做的最佳方式是什么?
这是显示条形按钮项目的奇怪位置的图像
我可以使用viewWillLayoutSubviews()动态获取导航栏高度,但我无法使用setTitlePositionAdjustment更改条形按钮项的位置
override func viewWillLayoutSubviews() {
guard let navbarHeight = self.navigationController?.navigationBar.frame.height else{ return }
}
Run Code Online (Sandbox Code Playgroud) 我正在使用ios 11视觉框架实时生成面部标志点.我能够获得面部标志点并使用面部标志点的UIBezierPath覆盖相机层.但是,我想得到类似右下角的图片.目前我的东西看起来像左图,我尝试循环点并添加中点,但我不知道如何从点生成所有这些三角形.我如何从左边的点开始生成右边的地图?
我不确定我能拿到所有的分数,而不是它会有太大的帮助,但我也从整个脸部的边界框中得到分数.最后,是否有任何框架可以让我认识到我需要的所有要点,比如openCV或其他什么,请告诉我.谢谢!
![]()
这是我从https://github.com/DroidsOnRoids/VisionFaceDetection使用的代码:
func detectLandmarks(on image: CIImage) {
try? faceLandmarksDetectionRequest.perform([faceLandmarks], on: image)
if let landmarksResults = faceLandmarks.results as? [VNFaceObservation] {
for observation in landmarksResults {
DispatchQueue.main.async {
if let boundingBox = self.faceLandmarks.inputFaceObservations?.first?.boundingBox {
let faceBoundingBox = boundingBox.scaled(to: self.view.bounds.size)
//different types of landmarks
let faceContour = observation.landmarks?.faceContour
self.convertPointsForFace(faceContour, faceBoundingBox)
let leftEye = observation.landmarks?.leftEye
self.convertPointsForFace(leftEye, faceBoundingBox)
let rightEye = observation.landmarks?.rightEye
self.convertPointsForFace(rightEye, faceBoundingBox)
let leftPupil = observation.landmarks?.leftPupil
self.convertPointsForFace(leftPupil, faceBoundingBox)
let rightPupil = observation.landmarks?.rightPupil
self.convertPointsForFace(rightPupil, faceBoundingBox)
let nose = observation.landmarks?.nose
self.convertPointsForFace(nose, …Run Code Online (Sandbox Code Playgroud)