Information Technology Reference
In-Depth Information
A plug-in has two advantages: The object can be added quickly with drag and drop, and it can include a custom
Inspector pane for properties. You should consider a plug-in if the following conditions exist:
You plan to sell or distribute it as part of a library of custom objects.
You are working with a development team and need to prepare one or more objects independently, but
you aren't responsible for their use in applications.
The objects require significant initialization, which is more easily done with a custom Inspector pane
than in code.
The objects will be reused over and over in many applications.
Creating custom objects is a project for intermediate and advanced developers and is outside the scope of this
topic. If you have experience with custom frameworks you can ind the oficial documentation by searching on-
line for Interface Builder Plug-In Programming Guide.
Creating Views with Static Images
Subclassing is a very powerful technique, and you can use it to customize any of the standard views and con-
trols. For example, by subclassing UIButton and adding custom drawing code controlled by a timer, you can
create buttons with pulsing dynamic color animations. As mentioned earlier in this chapter, some classes are
easier to modify and extend than others. But as a rule, subclassing is more likely to be limited by your ability to
imagine creative effects than by the limitations of iOS or OS X.
However, subclassing takes time. It's often useful to create simpler results such as a UI with a static fixed back-
ground. IB includes features to help you design and preview these less complex effects.
To create a static background to an iOS project, use a UIImageView object. Drag and drop it on the UI as
shown in Figure 8.10. Then drag its position in the object list so it's behind the other objects and higher up the
list. If you don't do this, the image view hides the other objects, which usually isn't what you want.
By default, the image view doesn't fill the UI. You can resize it manually by dragging the edges and corners, or
you can use the Fill Container Horizontally and Fill Container Vertically options in the Arrange menu in the
Size Inspector to expand the image to cover the available background space in the view.
FIGURE 8.10
Adding an image view to a UI is ideal for wallpaper and for static colored backgrounds.
 
Search WWH ::




Custom Search