Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

2. Implementing Controllers and Views > 2.17. Displaying Images with UIImageVie...

2.17. Displaying Images with UIImageView

Problem

You would like to display images to your users on your app’s UI.

Solution

Use the UIImageView class.

Discussion

The UIImageView is one of the least complicated classes in the iOS SDK. As you know, an image view is responsible for displaying images. There are no tips or tricks involved. All you have to do is to instantiate an object of type UIImageView and add it to your views. Now, I have a picture of Apple MacBook Air and I would like to display it in an image view. Let’s start with our view controller’s header file:

#import <UIKit/UIKit.h>

@interface Displaying_Images_with_UIImageViewViewController
           : UIViewController

@property (nonatomic, strong) UIImageView *myImageView;

@end

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial