メモリの問題(使用されているメモリが多すぎます)のため、アプリケーションがクラッシュしています。これは、私がTableViewからオブジェクトを十分に開いたときに発生します。私はインターネットでこの問題を調査しましたが、メモリが解放されていないためにこの問題が発生する可能性があります。しかし、私はそれをどのように解放するのですか?メモリの問題からUITable
ここに私のコードです。 ExerciseViewController
class ExerciseViewController: UIViewController {
weak var exercise: Exercise?
var receivedCellIndex = 0
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var lblExerciseName: UILabel!
@IBOutlet weak var lblExerciseMuscleGroup: UILabel!
@IBOutlet weak var lblStartDescription: UILabel!
@IBOutlet weak var lblLastDescription: UILabel!
@IBOutlet weak var imgExerciseAnimation: UIImageView!
@IBOutlet weak var imgExerciseStartPosition: UIImageView!
@IBOutlet weak var imgExerciseLastPosition: UIImageView!
var timer = NSTimer()
var counter = 1
override func viewDidLoad() {
super.viewDidLoad()
//Sets the color of the back button in navigation bar
self.navigationController!.navigationBar.tintColor = UIColor.whiteColor();
//Sets the labels
lblExerciseName.text = exercise?.name
lblExerciseMuscleGroup.text = exercise!.muscle
lblStartDescription.text = "1. \(exercise!.startDescription)"
lblLastDescription.text = "2. \(exercise!.lastDescription)"
//Sets the antimation and the images
imgExerciseAnimation.image = exercise?.exerciseImage1
imgExerciseStartPosition.image = exercise?.exerciseImage1
imgExerciseLastPosition.image = exercise?.exerciseImage2
//Timer
self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: #selector(ExerciseViewController.demonstrateExercise), userInfo: nil, repeats: true)
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
self.timer.invalidate()
}
func demonstrateExercise() {
if counter == 1 {
imgExerciseAnimation.image = exercise?.exerciseImage2
counter += 1
} else {
counter = 1
imgExerciseAnimation.image = exercise?.exerciseImage1
}
}
}
あなたはdidSelectRowイベントを意味するオブジェクトを開いていますか? – Alok
はい、それはセグを通過します。 @Alok – Grumme
各画像の大きさはどれくらいですか? – Xcoder