活动指示器出现在错误的视图层次结构中

在加载到下一个视图时,我已经设置了活动指示器。但是,返回原始视图时不会显示。它可以在另一个视图过渡上工作,但是我不知道为什么它在这里不起作用。

这是处理下一个视图的按钮单击功能:

@objc func remark(_ sender: UIButton) {
    ViewControllerUtils().showActivityIndicator(uiView: self.tableView)

    DispatchQueue.main.async {
        self.markDetailsDelegate?.getStudentList(paperId: sender.paperId!, schoolClass: sender.schoolClass!, studentToShow: sender.studentToShow, questionNo: sender.questionNo!, readOnlyFlag: false) { returnList, studentReturnList, returnMarkBox, returnMCOptionBox, returnStudentMarkList, error  in
            self.pdfFileList = returnList!
            self.studentList = studentReturnList!
            self.questionMarkBox = returnMarkBox!
            self.mcQuestionOptionBox = returnMCOptionBox!
            self.studentMarkList = returnStudentMarkList!
        }

        DispatchQueue.main.async {
            ViewControllerUtils().hideActivityIndicator(uiView: self.tableView)
        }
    }
}

我试图弄清楚为什么通过使用Debug View Hierarchy返回原始视图时未显示该指示符,结果如下:

在转场期间我做错什么了吗?非常感谢有人能帮助我!

评论
  • D_G
    D_G 回复

    我认为应该

    @objc func remark(_ sender: UIButton) {
        ViewControllerUtils().showActivityIndicator(uiView: self.tableView)
    
        self.markDetailsDelegate?.getStudentList(paperId: sender.paperId!, schoolClass: sender.schoolClass!, studentToShow: sender.studentToShow, questionNo: sender.questionNo!, readOnlyFlag: false) { returnList, studentReturnList, returnMarkBox, returnMCOptionBox, returnStudentMarkList, error  in
    
            DispatchQueue.main.async {
                ViewControllerUtils().hideActivityIndicator(uiView: self.tableView)
    
                self.pdfFileList = returnList!
                self.studentList = studentReturnList!
                self.questionMarkBox = returnMarkBox!
                self.mcQuestionOptionBox = returnMCOptionBox!
                self.studentMarkList = returnStudentMarkList!
            }
        }
    }