Information Technology Reference
In-Depth Information
Once assigned, the image view loads the file automatically when the app runs. No further code is needed. You
also can preview the image in place in the UI, although certain features such as PNG transparency may not
work reliably. Figure 8.16 shows the result.
TIP
To assign a custom image to a button, set the button type to Custom in the Attributes Inspector and assign the im-
age file to the Background property— not the Image property. This is enough to implement basic highlighting, and
the button darkens when tapped. Buttons have four potential states, but you can ignore the other states unless
you're creating complex effects. The Background property defines the button's default look. You can layer the
Image property on top of the button for more complex effects.
NOTE
Although OS X supports an NSImageView class that is similar to UIImageView in iOS, OS X applications are less
likely to use background wallpaper. Images are usually used as decorative icons. The iOS Media Library is empty
by default. The OS X Media Library includes a selection of standard icons and sounds that you can drag into your
application without having to import them. Use the Image Well object with no border to duplicate the effect of an
iOS image view.
FIGURE 8.16
The modified UI with background wallpaper, which Xcode correctly previews in the IB editor
Search WWH ::




Custom Search