2023年04月復(fù)盤(pán)篇:iOS問(wèn)題解決經(jīng)驗(yàn)總結(jié)復(fù)盤(pán)

??

目錄
一、編譯報(bào)錯(cuò)/bin/sh: bad interpreter: Operation not permitted Command PhaseScriptExecution failed with a nonzero exit code
二、如何獲取UISlider滑桿的中心位置

一、編譯報(bào)錯(cuò):xx/bin/sh: bad interpreter: Operation not permittedCommand PhaseScriptExecution failed with a nonzero exit code

問(wèn)題紀(jì)要:
由于想看看一下SJVideoPlayer框架源碼以及示例,結(jié)果下載之后報(bào)錯(cuò)/bin/sh: bad interpreter: Operation not permitted Command PhaseScriptExecution failed with a nonzero exit code,嘗試pod install 以及pod updata 依然無(wú)效,還是報(bào)這個(gè)錯(cuò)誤好奇怪,也不知道為何會(huì)報(bào)沒(méi)有執(zhí)行權(quán)限的問(wèn)題

解決辦法:在工程根目錄,用這個(gè)命令來(lái)去除這個(gè)屬性:
xattr -d -r com.apple.quarantine ./*

二、如何獲取UISlider滑桿的中心位置

效果圖.gif

分享這個(gè)的解決方案思路:

在分析之前,先安利一個(gè)UI調(diào)試庫(kù)(LookinServer) ,開(kāi)發(fā)必備神器。反正我經(jīng)常會(huì)用到這個(gè)。不得不說(shuō)這個(gè)真的很實(shí)用。在Podfile中導(dǎo)入

  # UI 調(diào)試庫(kù)
  pod 'LookinServer', :git => 'https://gitee.com/chuansong16/LookinServer.git', :configurations => ['Debug']

其次就是需要下載一個(gè)Lookin的軟件。從而查看他的層次結(jié)果,從而在結(jié)構(gòu)中我們能發(fā)現(xiàn)其底層是用UIImageView去承載滾動(dòng)的那個(gè)軸。

image.png

具體實(shí)現(xiàn)如下代碼:

     /// ***slider初始化xxx代碼,然后添加事件
        slider.addTarget(self, action:#selector(seliderProgress(_:)) , for: .valueChanged)

    // 美顏度進(jìn)度事件
     @objc private func seliderProgress(_ slider: UISlider) {
         setupBeautyProgressConstraints()
         let integerValue = Int(slider.value)
         beautySlider.value = Float(integerValue)
         beautyProgressLabel.text =  "\(integerValue)"
        print("===== value:\(integerValue)")
     }
    /// 更新滑桿值label的約束
   private func setupBeautyProgressConstraints(){
        if let elementClass = NSClassFromString("_UISlideriOSVisualElement"),
           let imageClass = NSClassFromString("UIImageView"){
            for tempView in beautySlider.subviews where tempView.isKind(of: elementClass) {
                for tempImgView in tempView.subviews where tempImgView.isKind(of: imageClass) {
                    beautyProgressLabel.snp.remakeConstraints{
                        $0.centerX.equalTo(tempImgView.snp_centerX)
                        $0.centerY.equalTo(tempImgView.snp_centerY).offset(-20)
                    }
                }
            }
        }
    }
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容