Changes

Jump to: navigation, search

Creating an Interactive iOS 8 App (Swift)

863 bytes added, 15:06, 4 December 2014
no edit summary
[[Image:xcode_6_main_window_unit_converter.png|A single scene in an Xcode 6 storyboard]]
Figure 16-1
[[Image:xcode_6_unitconverter_text_view.png|Image:A UITextField view added to an Xcode 6 storyboard scene]]
Figure 16-2
[[Image:xcode_6_resolve_auto_layout_button.png|Image:The Xcode 6 "Resolve Auto Layout Issues" button]]
Figure 16-3
[[Image:xcode_6_resolve_Auto_layout.png|Image:Resetting Auto Layout to suggested constraints]]
Figure 16-4
[[Image:ios_8_converter_ui.png|Image:The user interface layout for the iOS 8 interactive app example]]
Figure 16-5
[[Image:xcode_6_assistant_editor_button.png|Image:The Xcode 6 Assistant Editor toolbar button]]
Figure 16-6
[[Image:xcode_6_assistant_editor.png|Image:The Xcode 6 Assistant Editor]]
Figure 16-7
[[Image:xcode_6_unit_converter_outlet_drag.png|Image:Establishing an outlet connection in Xcode 6]]
Figure 16-8
[[Image:xcode_6_establish_outlet.png|Image:Establishing an outlet connection in Xcode 6]]
Figure 16-9
Next we need to establish the action that will be called when the user touches the Convert button in our user interface. The steps to declare an action using the Assistant Editor are essentially the same as those for an outlet. Once again, select the Main.storyboard file, but this time Ctrl-click on the button object. Drag the resulting line to the area beneath the existing viewDidLoad method in the Assistant Editor panel before releasing it. The connection box will once again appear. Since we are creating an action rather than an outlet, change the Connection menu to Action. Name the action convertTemp and make sure the Event type is set to Touch Up Inside:
[[Image:xcode_6_establish_action.png|Image:Establishing an action connection in Xcode 6]]
Figure 16-10
[[Image:ios_8_unitconverter_running.png|Image:The iOS 8 example Swift app running]]
Figure 16-11
[[Image:xcode_6_did_end_on_exit.png|Image:Setting up an action to hide the keyboard in iOS 8]]
Figure 16-12

Navigation menu