| | |
| | | let collection = UICollectionView(frame: .zero, collectionViewLayout: flowLayout) |
| | | collection.register(UINib(nibName: "ListenFight_lesson_3_CCell", bundle: nil), forCellWithReuseIdentifier: "_ListenFight_lesson_3_CCell") |
| | | collection.register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header") |
| | | collection.isScrollEnabled = false |
| | | return collection |
| | | }() |
| | | |
| | |
| | | |
| | | @objc private func chooseAnswerAction(btn:UIButton){ |
| | | |
| | | guard viewModel.selectIndex != nil else {return} |
| | | |
| | | if !islisten{ |
| | | alertError(msg: "请先听题");return |
| | | } |
| | |
| | | } |
| | | |
| | | guard ansterIndePath != nil else {return} |
| | | self.viewModel.selectIndex.accept(nil) |
| | | |
| | | if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_ListenFight_lesson_3_CCell", for: ansterIndePath!) as? ListenFight_lesson_3_CCell{ |
| | | var newFrame = cell.img_cover.convert(cell.img_cover.bounds, to: self.view) |
| | |
| | | } completion: { _ in |
| | | self.answterCount += 1 |
| | | self.voicePlayer.playerAt(url: self.listenNewModel.subjectList[self.page][valueIndex].correct) |
| | | |
| | | DispatchQueue.main.asyncAfter(deadline: .now()+1.0) { |
| | | self.setAnswerStackView() |
| | | self.viewModel.selectIndex.accept(nil) |
| | | let v = self.rootViewModel.answerCount.value + 1 |
| | | self.rootViewModel.answerCount.accept(v) |
| | | self.collectionView.reloadData() |