Reputation: 6949
So I just spent like one hour Googling for some answers.
imageView.image = (UIImage instance)
Now the image changed, but it's not centered anymore.
Also, here's an interesting thing: I tried also not changing image in IB, I just left it set to some image and then I changed image from code. I could see both images! The one set in IB was centered (like I want it) and the new one was overlaying on the left.
Any ideas please?
Also I probably lack some basic knowledge of this View stuff, can anyone please point me at documentation where this is explained?
Upvotes: 2
Views: 505
Reputation: 6949
I got it! Thanks James Huddleston for useful comments.
You were right. There must have been to UIImageViews.
Here's what happened. I actually used viewWithTag: to find that view (it wasn't linked directly - it was in a UITableViewCell). Well, it apparently didn't work with 0, when I changed tag to 1 - it worked.
Upvotes: 0
Reputation: 8448
It sounds like you have two overlapping UIImageView
subviews. One of them is referenced by imageView
in your view controller and doesn't center. The other isn't referenced by your view controller but does center. The solution would be to get rid of the non-referenced image view.
Upvotes: 1