The following sections describe the basic support for text and web content in iPhone OS.
The UIKit framework provides three primary classes for displaying text content:
These classes support the display of arbitrarily large amounts of text, although labels and text fields are typically used for relatively small amounts of text. To make the displayed text easier to read on the smaller screens of iPhone OS–based devices, however, these classes do not support the kinds of advanced formatting you might find in desktop operating systems like Mac OS X. All three classes still allow you to specify the font information, including size and styling options, that you might otherwise want, but the font information you specify is applied to all of the text associated with the object.
Figure shows examples of the available text classes as they appear on screen. These examples were taken from the UICatalog sample application, which demonstrates many of the views and controls available in UIKit. The image on the left shows several different styles of text fields while the image on the right shows a single text view. The callouts displayed on the gray background are themselves UILabel objects embedded inside the table cells used to display the different views. There is also a UILabel object with the text “Left View” at the bottom of the screen on the left.
Text classes in the UICatalog application
When working with editable text views, you should always provide a delegate object to manage the editing session. Text views send several different notifications to the delegate to let them know when editing begins, when it ends, and to give them a chance to override some editing actions. For example, the delegate can decide if the current text contains a valid value and prevent the editing session from ending if it does not. When editing does finally end, you also use the delegate to get the resulting text value and update your application’s data model.
Because there are slight differences in their intended usage, the delegate methods for each text view are slightly different. A delegate that supports the UI TextField class implements the methods of the UI Text Field Delegate protocol. Similarly, a delegate that supports the UITextView class implements the methods of the UI Text View Delegate protocol. In both cases, you are not required to implement any of the protocol methods but if you do not, the text field is not going to be of much use to you. For more information on the methods in these two protocols, see UI Text Field Delegate Protocol Reference andUI Text View Delegate Protocol Reference.
In addition to displaying content, you can also use a web view object to gather input from the user through the use of web forms. Like the other text classes in UIKit, if you have an editable text field on a form in your web page, tapping that field brings up a keyboard so that the user can enter text. Because it is an integral part of the web experience, the web view itself manages the displaying and dismissing of the keyboard for you.
Figure shows an example of a UIWebView object from the the UICatalog sample application, which demonstrates many of the views and controls available in UIKit. Because it just displays HTML content, if you want the user to be able to navigate pages much like they would in a web browser, you need to add controls to do so. For example, the web view in the figure occupies the space below the text field containing the target URL and does not contain the text field itself.
A web view
A web view provides information about when pages are loaded, and whether there were any load errors, through its associated delegate object. A web delegate is an object that implements one or more methods of the UI Web View Delegate protocol. Your implementations of the delegate methods can respond to failures or perform other tasks related to the loading of a web page. For more information about the methods of the UI Web View Delegate protocol, see UI Web View Delegate Protocol Reference.
Keyboards and Input Methods
Whenever the user taps in an object capable of accepting text input, the object asks the system to display an appropriate keyboard. Depending on the needs of your program and the user’s preferred language, the system might display one of several different keyboards. Although your application cannot control the user’s preferred language (and thus the keyboard’s input method), it can control attributes of the keyboard that indicate its intended use, such as the configuration of any special keys and its behaviors.
You configure the attributes of the keyboard directly through the text objects of your application. The UI TextField and UITextView classes both conform to the UI Text Input Traits protocol, which defines the properties for configuring the keyboard. Setting these properties programmatically or in the Interface Builder inspector window causes the system to display the keyboard of the designated type.
The default keyboard configuration is designed for general text input. Figure displays the default keyboard along with several other keyboard configurations. The default keyboard displays an alphabetical keyboard initially but the user can toggle it and display numbers and punctuation as well. Most of the other keyboards offer similar features as the default keyboard but provide additional buttons that are specially suited to particular tasks. However, the phone and numerical keyboards offer a dramatically different layout that is tailored towards numerical input.
Several different keyboard types
To facilitate the language preferences of different users, iPhone OS also supports different input methods and keyboard layouts for different languages, some of which are shown in Figure. The input method and layout for the keyboard is determined by the user’s language preferences.
Several different keyboards and input methods
IPHONE APPS Related Interview Questions
|C Interview Questions||IPHONE APPS Interview Questions|
|Mobile Testing Interview Questions||Oracle apps Interview Questions|
|Java Native Interface (JNI) Interview Questions||JNDI (Java Naming and Directory Interface) Interview Questions|
|Mobile computing Interview Questions||jQuery Mobile Interview Questions|
|Mobile Security Interview Questions||Objective C Interview Questions|
|Mobile Developer Interview Questions||Mobile Application Testing Interview Questions|
|Apps Associates Manual Testing Interview Questions||Mobile Marketing Interview Questions|
Iphone Apps Tutorial
The Core Application
Window And Views
Graphics And Drawing
Text And Web
Files And Networking
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.