3
私はエクササイズアプリケーションを構築しています。私は私のTableViewControllerで、各セルが別のエクササイズを表示しながら一連のエクササイズをしています。セルは、UIViewControllerに分割されます。 UIViewController内で、ユーザーはTableViewControllerに戻らずに、次のエクササイズをスキップできるようになりました。Swiftの新しいデータでUIViewControllerをリフレッシュ
次の練習問題の新しいデータを含むViewControllerを更新するにはどうすればよいですか? (テーブルの作成時にreloadDataメソッドに似ています)
私は配列の次の演習を行っていますが、私のページはリフレッシュしていません。 マイコード:
var exercise: Exercise?
var exerciseList: [Exercise]!
// toolbar item button pressed:
@IBAction func nextExercise(sender: UIBarButtonItem) {
if let currentIndex = exerciseSet.indexOf(exercise!) {
let nextIndex = currentIndex + 1
let nextExercise = exerciseList[nextIndex]
reloadData(nextExercise)
}
}
private func reloadData(displayedExercise: Exercise){
exercise = displayedExercise
self.view.setNeedsDisplay()
}
ありがとう!