1

In some situations I need to remove UIImageView, but element below UIImageView has top margin in respect to UIImageView so I need to set height of UIImageView to 0 (or 1 if you can't set 0) and set ishidden property of UIImageView to true.

I tried this

imageView.frame = CGRect(x: imageView.frame.origin.x, y: imageView.frame.origin.y, width: 0, height: 0)

but nothing happens, UIImageView is not updated.

Cœur
  • 37,241
  • 25
  • 195
  • 267
user3847113
  • 307
  • 1
  • 3
  • 12
  • What do you mean by "not working"? Does it crash or does it not update? – Adrian Oct 29 '16 at 13:54
  • @Adrian It's not updating. – user3847113 Oct 29 '16 at 14:03
  • 1
    You might want to find something else to use as a reference for the element below your `UIImageView`. Have a peek at this re: updating constraints. http://stackoverflow.com/questions/28127259/how-to-update-the-constant-of-a-constraint-programmatically-in-swift Also, you can `ctrl+drag` constraints from your storyboard to your `UIViewController` and create an `IBOutlet` for it and have a reference to update the constraint programmatically. – Adrian Oct 29 '16 at 14:10

0 Answers0