Changes

Jump to: navigation, search

Creating an Interactive iOS 8 App (Swift)

917 bytes added, 13:45, 2 November 2016
no edit summary
[[Image:xcode_8_unitconverter_new_project.png|A new Xcode project]]
Figure 16-1
[[Image:xcode_8_unitconverter_text_field.png|A simple example user interface layout]]
Figure 16-2
[[Image:xcode_6_resolve_auto_layout_button.png|The Xcode 8 "Resolve Auto Layout Issues" button]]
Figure 16-3
[[Image:xcode_8_reset_to_suggested.png|The Interface Builder Resolve Auto Layout issues menu]]
Figure 16-4
[[Image:xcode_8_unitconverter_ui.png|Example iOS user interface built using Interface Builder in Xcode 8]]
Figure 16-5
[[Image:xcode_6_assistant_editor_button.png|The Xcode 8 Assistant Editor toolbar button]]
Figure 16-6
<htmlet>ios10</htmlet>
In the event that multiple Assistant Editor panels are required, additional tiles may be added using the View -> Assistant Editor -> Add Assistant Editor menu option.
 
By default, the editor panel will appear to the right of the main editing panel in the Xcode window. For example, in Figure 16 7 the panel to the immediate right of the Interface Builder panel is the Assistant Editor:
[[Image:xcode_8_assistant_editor_panel.png|The Xcode 8 Assistant Editor panel]]
Figure 16-7
[[Image:xcode_6_unit_converter_outlet_drag.png|Establishing an outlet connection in Xcode 8]]
Figure 16-8
Upon releasing the line, the configuration panel illustrated in Figure 16 -9 will appear requesting details about the outlet to be defined.
[[Image:xcode_6_establish_outlet.png|Establishing an outlet connection in Xcode 8]]
Figure 16-9
[[Image:xcode_6_establish_action.png|Establishing an action connection in Xcode 8]]
Figure 16-10
[[Image:ios_8_unitconverter_running.png|The iOS example Swift app running]]
Figure 16-11
The next step is to hide the keyboard when the return key is tapped. To do this, display the Assistant Editor and Ctrl-click and drag from the Text Field to a position beneath the viewDidLoad method within the ViewController.swift file. On releasing the line, change the settings in the connection dialog to establish an Action connection named textFieldReturn for the Did End on Exit event as shown in Figure 16-12 and click on the Connect button to establish the connection.
[[Image:xcode_6_did_end_on_exit.png|Setting up an action to hide the keyboard in iOS]]
Figure 16-12

Navigation menu