I came across this very peculiar problem where I am unable to modify the frame of a UIImageView.
I have isolated it to this very simple example. Starting from a default single view application xcode template, I add a UIImageView in Interface Builder, link it to the ViewController property called testImage, and in ViewController.m I add:
-(void)viewDidAppear:(BOOL)animated{
UIImageView* maskImage = [[UIImageView alloc] initWithFrame:self.testImage.frame];
maskImage.image = self.testImage.image;
maskImage.alpha = 0;
[self.view addSubview:maskImage];
self.testImage.frame = CGRectMake(10, 10, 10, 10);
}
and it does not work. The test image remains resolutely where it was. If I do not add maskImage to view, the example works. And, yes I am sure I am not covering the destination with maskImage.
If I do not use the IB to place the image, but instead use:
self.testImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 100, 300, 300)];
self.testImage.image = [UIImage imageNamed:@"jim-105.png"];
[self.view addSubview:self.testImage];
in viewDidLoad it all works as expected.
I have also tried to just place the image in IB, then set its properties in viewDidLoad, but with the same effect. I have been trying this in Xcode5. I do not have access to previous Xcode here, and I am not sure is this an expected behaviour (and if so why) or is this a bug?