Good day. in the course of writing the program encountered such a problem. There is an array of json results where various data is stored, including the url of the image that needs to be displayed in the uitableviewcell. the task is to display two images in one cell when the device is rotated to landscape orientation. so far, it turned out to display two identical images, in other cases the index went beyond the array, and the first image from the next cell repeated the second image from the previous one. How is it necessary to edit my code so that you can display two different images from the array of results and not face the fact that the next cell displays the second image from the previous one?
actually, code:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell switch UIDevice.current.orientation { case UIDeviceOrientation.landscapeLeft, UIDeviceOrientation.landscapeRight: //view two pictures in cell when device orientation is landscape cell.entry = self.results?[indexPath.row] cell.nextEntry = self.results?[indexPath.row] default: cell.entry = self.results?[indexPath.row] } return cell } necessary data is transferred to the enrty and nextentry cell (entry for the first imageview, nextentry for the second)