Images don't display when orientation is changed

I'm trying to display some tiles UIImageViews with various orientations as follows:

let kOrientation:[UIImage.Orientation] = [

    UIImage.Orientation.up,

    UIImage.Orientation.upMirrored,

    UIImage.Orientation.downMirrored,

    UIImage.Orientation.down

]

    // Construct the imageview

    let cgimg = UIImage(named: "t (tile.fTileID)")!.cgImage

    let image = UIImage(cgImage:cgimg!, scale: 1.0, orientation: kOrientation[tile.fOrient])     let iview = UIImageView(image:image)

    tile.fView = iview

    gMapView.addSubview(iview)

... but the image appears ONLY when the orientation is UIImage.Orientation.up. How do I get the image to appear at other orientations?

  • Can you show us a complete code to reproduce the issue?

  • Apologies. When constructing some code to demonstrate the problem, I couldn't reproduce it.

Add a Comment

Replies

Does it depend on image ? Maybe your image is such that when rotated you see only an empty part ?

Anyway, you seem to have solved the problem. Don't forget to close the thread.