You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MHLoadingButton加载状态下加载圆圈不显示问题求助

MHLoadingButton加载状态下加载圆圈不显示问题求助

我现在碰到个MHLoadingButton的问题,捣鼓半天都没搞定,有没有老哥能帮我排查下?我在项目里用了MHLoadingButton,逻辑流程是通的,但加载状态的表现不对:当触发加载时,按钮的标题确实会被清空,但加载的转圈动画完全看不到;等加载结束后,按钮标题又能正常变回“Rephrase”。

下面是我的按钮点击事件代码:

@IBAction func btnRephrasePressed(_ sender: LoadingButton) {
    print("Mode: \(selectedMode ?? "Default"), Tone: \(selectedTone)")
    sender.setTitle("", for: .normal)
    sender.isLoading = true
    sender.setNeedsDisplay()
   
    APIRequests.rephraseText(textView.text, mode: selectedMode ?? "rephrase", tone: selectedTone) { data, response, error in
        
        DispatchQueue.main.async {
            sender.isLoading = false
            sender.setTitle("Rephrase", for: .normal)
            
        }

        if response == .success {
            if let str = data as? String {
                let controller = ResultViewController.loadNib()
                controller.modalTransitionStyle = .coverVertical
                controller.modalPresentationStyle = .formSheet
                controller.genText = str
               
                DispatchQueue.main.async {
                    self.present(controller, animated: true)
                }
            }
        } else {
            
            print("Error: \(error ?? "An unknown error occurred")")
        }
    }
}

备注:内容来源于stack exchange,提问作者Tanu Purohit

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 08:59:50