In this recipe, we will discuss how to add and customize UIView
with Xcode's Interface Builder.
Adding views with Interface Builder is a simple task. Let's start by creating a new
iPhone Single View Application
project in Xamarin Studio. Name the project FirstViewApp
and open the FirstViewAppViewController.xib
file with Interface Builder.
Perform the following steps:
To add a view to the project, drag-and-drop a
UIView
object from the Library pad onto the main view. Make sure that it fits the entire window area. To makeUIView
accessible, create an outlet for it and name itsubView
.Note
The concept of outlets and how to use them is discussed in detail in Chapter 1, Development Tools.
Select the view that we have just added and go to the Inspector pad. Select the Attributes tab, and select Dark Gray Color in the Background drop-down list. Now, select the Size tab and reduce the view's height by 60 points. Save the document.
Compile and run...