Graphics Programs Reference
In-Depth Information
A UIImageView displays an image according to its contentMode property. This
property determines where to position and how to resize the content within its frame.
UIImageView 's default value for contentMode is UIViewCon-
tentModeScaleToFill , which will adjust the image to exactly match the bounds of
the image view. If you keep the default, the image taken by the camera will be contorted
to fit into the square UIImageView . You have to change the contentMode of the im-
age view so that it resizes the image with the same aspect ratio.
Select the UIImageView and open the attributes inspector. Find the Mode attribute and
change it to Aspect Fit , as shown in Figure 12.3 . This will resize the image to fit within
the bounds of the UIImageView .
Figure 12.3 Image view attributes
Now, Option-click DetailViewController.h in the project navigator to open it in
the assistant editor. Control-drag from the UIImageView to the instance variable area in
DetailViewController.h . Name the outlet imageView and choose Weak as the
storage type. Click Connect .
DetailViewController 's instance variable area should now look like this:
@interface DetailViewController : UIViewController
{
__weak IBOutlet UITextField *nameField;
__weak IBOutlet UITextField *serialNumberField;
__weak IBOutlet UITextField *valueField;
__weak IBOutlet UILabel *dateLabel;
__weak IBOutlet UIImageView *imageView;
}
 
Search WWH ::




Custom Search