Android
In Android we programmatically create a "connection" between a reference and a UI widget. The Android compiler generates a R.java file from the xml layouts. To touch a widget in the layout in Android we first declare a reference as in:
private TextView textViewBody;
We can then "connect" the reference to the widget using the call findViewById in say onCreate as in:
textViewBody= (TextView)findViewById(R.id.textViewDisplayBody);
iOS
In iOS we declare the reference to a text field in MyViewController.h as in:
@interface MyViewController : UIViewController {
IBOutlet UITextField *textField1;
}
@end
We then graphically create a connection by opening MyViewController.xib in Interface Builder and control-click drag from the File's Owner icon to the UITextField, selecting the appropriate reference, textField1, from the pop up list.
We may wish to "release" the IBOutlet in viewDidUnload as in:
- (void)viewDidUnload {
// Release any retained subviews of the main view.
self.textField1 = nil;
}