Skip navigation

Monthly Archives: February 2013

I had a UIImageView control set up in one of my Views using Interface Builder, but I wanted to resize the UIImageView control programmatically depending on the device’s screen size.  I spent several hours trying all sorts of techniques, but I always had problems.  If I resized the UIImageView’s frame in viewDidLoad, it simply wouldn’t work.  If I resized its frame in viewDidAppear, it would work but the user would see the original-sized image before switching to the updated size which I felt was ugly and unnecessary.

I finally found a solution that would show the correctly resized UIImageView right away, but it required me to remove the UIImageView from my .XIB file, remove the outlet from Interface Builder, and remove the IBOutlet from my header file.  Then I simply programmatically added the UIImageView to the view in my viewDidLoad like so:

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 173, 728, 771)];
imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.image = [UIImage imageNamed:@"tutorial1.png"];
[self.view addSubview:imageView];

That’s right, friends:  SecretCam 2 is now available in the Apple App Store!  Featuring the much-anticipated Rear Camera Mode for discrete photos and faster performance, it’s a must-have for any iPhone/iPad owner.  We were also blessed to be able to work with the lovely Croix Provence for some updated sample photos.  Please check out her website (http://www.CroixProvence.com), and download or update to SecretCam 2 today!

Download SecretCam in the App Store