Configuring the SubscribeController View

Use Interface Builder to configure the SubscribeController.xib file and create the user interface. Although the provided XIB file is already configured, you can walk through the steps to see how to create the interface.
  1. Click the SubscribeController.xib file to reveal a view of the (presently empty) screen in the right pane and the following three items represented by icons in the middle pane:
    • File's Owner – the object that is set to be the owner of the user interface, which is typically the object that loads the interface. In this tutorial, this is the SubscribeController.
      File's Owner icon

    • First Responder – the first responder proxy object handles events. Connecting an action to the first responder means that when the action is invoked, it is dynamically sent to the responder chain.
      First Responder icon

    • View – appears in a separate window to allow editing.
      View icon

  2. Select the File's Owner icon, click View in the utility area, click Show the Identity Inspector, and make sure SubscribeController appears in the Class field under Custom Class.

    Custom Class - Class field with SubscribeController
    This tells Interface Builder the class of the object to allow you to make connections to and from the File's Owner.
  3. Click the View icon, and in the Identity Inspector panel, and make sure UIView appears in the Class field under Custom Class.

    Custom Class - Class field with UIView
  4. To create a Subscribe button, select View > Utilities > Show Object Library.
    1. In the Object Library pane, select the Round Rect Button item, and drag it onto the view.

      Object Library panel - Round Rect Button item
    2. Double-click it, enter Subscribe, and press Enter.
  5. To make connections to the user interface from the view controller, the SubscribeController.h file contains the outlets, property declarations for the instance variables, and a declaration for the action method.
    -(IBAction)buttonPressed:(id)sender;
    
    @property (nonatomic, retain) IBOutlet UIButton *button;
    @property (nonatomic, retain) MenuListController *menuController;
  6. In the Accessibility section of the Identity Inspector, unselect Enabled.
    The application cannot subscribe to the server for updates until it is connected.
    Accessibility options
  7. Ctrl-click the Subscribe button to show the inspector.
  8. Drag from the circle to the right of Touch Up Inside to the File's Owner icon and release, then click buttonPressed to establish a connection between the Subscribe button and the button's action method:

    Subscribe button options

Comments

Popular posts from this blog

How to draw an overlay on a SurfaceView used by Camera on Android?

Android TCP Connection Chat application

Create EditText with dropdown in android