My UIImageView is always blank. When the image view is loaded I have it print the image and image view out. This is the output from the print in first section of code: UIImage: 0x170898010>, {4032, 3024} UIImageView: 0x14bb077e0; frame = (0 64; 375 554); This is the output from the print in second section of code: autoresize = RM+BM; userInteractionEnabled = NO; layer = CALayer: 0x170a31240 It seems to be storing the image but it does not appear.
Here is where the image, which is saved correctly to CloudKit is downloaded and converted:
if let asset = record["Picture"] as? CKAsset,
let data = NSData(contentsOf: asset.fileURL),
let image1 = UIImage(data: data as Data)
{
let eventPageViewController:EventPageViewController = self.storyboard?.instantiateViewController(withIdentifier: "EventPage") as! EventPageViewController
eventPageViewController.toPass = image1
print(image1)
}
Here is the code for the ViewController that displays the UIImageView:
class EventPageViewController: UIViewController {
@IBOutlet weak var eventPic: UIImageView!
var toPass: UIImage!
override func viewDidLoad() {
super.viewDidLoad()
eventPic.image = toPass
print(eventPic)
}
here is where the eventPageViewController appears:
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
let eventPageViewController:EventPageViewController = storyboard?.instantiateViewController(withIdentifier: "EventPage") as! EventPageViewController
self.present(eventPageViewController, animated: true, completion: nil)
}