15
© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property. AT&T U-verse® Enabled How to Use a uveDataSource to Update On-screen Content in the TV UI API Publication Date: November 1 st , 2013

AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

AT&T U-verse® Enabled

How to Use a uveDataSource to Update On-screen Content in the TV UI API

Publication Date: November 1st, 2013

Page 2: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

Legal Disclaimer

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

i

This document and the information contained herein (collectively, the "Information") is provided to you (both the individual receiving

this document and any legal entity on behalf of which such individual is acting) ("You" and "Your") by AT&T, on behalf of itself and

its affiliates ("AT&T") for informational purposes only. AT&T is providing the Information to You because AT&T believes the

Information may be useful to You. The Information is provided to You solely on the basis that You will be responsible for making

Your own assessments of the Information and are advised to verify all representations, statements and information before using or

relying upon any of the Information. Although AT&T has exercised reasonable care in providing the Information to You, AT&T does

not warrant the accuracy of the Information and is not responsible for any damages arising from Your use of or reliance upon the

Information. You further understand and agree that AT&T in no way represents, and You in no way rely on a belief, that AT&T is

providing the Information in accordance with any standard or service (routine, customary or otherwise) related to the consulting,

services, hardware or software industries.

AT&T DOES NOT WARRANT THAT THE INFORMATION IS ERROR-FREE. AT&T IS PROVIDING THE INFORMATION TO YOU

"AS IS" AND "WITH ALL FAULTS." AT&T DOES NOT WARRANT, BY VIRTUE OF THIS DOCUMENT, OR BY ANY COURSE OF

PERFORMANCE, COURSE OF DEALING, USAGE OF TRADE OR ANY COLLATERAL DOCUMENT HEREUNDER OR

OTHERWISE, AND HEREBY EXPRESSLY DISCLAIMS, ANY REPRESENTATION OR WARRANTY OF ANY KIND WITH

RESPECT TO THE INFORMATION, INCLUDING, WITHOUT LIMITATION, ANY REPRESENTATION OR WARRANTY OF

DESIGN, PERFORMANCE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, OR

ANY REPRESENTATION OR WARRANTY THAT THE INFORMATION IS APPLICABLE TO OR INTEROPERABLE WITH ANY

SYSTEM, DATA, HARDWARE OR SOFTWARE OF ANY KIND. AT&T DISCLAIMS AND IN NO EVENT SHALL BE LIABLE FOR

ANY LOSSES OR DAMAGES OF ANY KIND, WHETHER DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE,

SPECIAL OR EXEMPLARY, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS

INTERRUPTION, LOSS OF BUSINESS INFORMATION, LOSS OF GOODWILL, COVER, TORTIOUS CONDUCT OR OTHER

PECUNIARY LOSS, ARISING OUT OF OR IN ANY WAY RELATED TO THE PROVISION, NON-PROVISION, USE OR NON-USE

OF THE INFORMATION, EVEN IF AT&T HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES OR DAMAGES.

IOS is a trademark or registered trademark of Cisco in the U.S. and other countries.

Page 3: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

Table of Contents

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

ii

Contents

1 Introduction .......................................................................................................................................... 1

1.1 Additional Resources .................................................................................................................... 2

2 Using uveDataSources to Update On-screen Content .......................................................................... 3

Page 4: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

Table of Examples

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

iii

Example 2-1: resourceForName XML ........................................................................................................... 3

Example 2-2: Create uveDataSource object. ................................................................................................ 3

Example 2-3: uveActionRefresh .................................................................................................................... 4

Example 2-4: uveTextBox .............................................................................................................................. 4

Example 2-5: uveTextBox ............................................................................................................................. 5

Example 2-6: Converting an NSString to a utf-8 string. ................................................................................ 6

Example 2-7: textFieldShouldEndEditing ...................................................................................................... 6

Page 5: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 1 of 11

1 Introduction

This document is intended for developers who are using the AT&T U-verse Enabled SDK with the TV UI API to create U-verse Enabled applications. You should first be familiar with how to setup the uveTVApplicationServer protocol. This is covered in the “How to Use the TV UI API” document.

This document contains a tutorial that uses a simple data entry example to show how to use the uveDataSource object to display content on the screen. This example is part of the Remote Control and TV UI API Sample code. This example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen after the user updates each field. The information that the user will be filling in is their favorite TV show, animal, color, car, place, food, and drink.

Screenshot 1-1: App View Controller

Page 6: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 2 of 11

Screenshot 1-2: Page Displayed on TV Screen

1.1 Additional Resources

In addition to this document, you may find the following documents helpful when developing U-verse Enabled iOS apps.

How to Write Your First AT&T U-verse Enabled iOS App

How to Set Up a U-verse Enabled Project in Xcode

You can find more technical information on the AT&T Developer Program web site. See Develop AT&T U-verse ® Enabled Apps and select the development platform that you are interested in.

Page 7: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 3 of 11

2 Using a uveDataSource to Update On-screen Content

In the PageForName:withParams:forFrame: method, this example creates a uveDataSource object that is a mapping to the XML that contains the information that the user entered on the view controller. The XML that is provided by the resourceForName callback method is in the following form.

resourceForName XML

1 | <input>

2 | <tvShow>tvShowData</tvShow>

3 | <animal>Please enter your favorite animal.</aminal>

4 | <color>Please enter your favorite color.</color>

5 | <car>Please enter your favorite car.</car>

6 | <place>Please enter your favorite place.</place>

7 | <food>Please enter your favorite food.</food>

8 | <drink>Please enter your favorite drink.</drink>

9 | </input>

Example 2-1: resourceForName XML

The following code creates the uveDataSource object and adds it to the uvePage object. Each time you create an element in code the element will need to be added to the page which can be done using the addGadget method of the uvePage object. The final step in the pageForName:withParams:forFrame is to return the uvePage that was just created. This can be seen in the full listing of the PageForName:withParams:forFrame: method at the end of this document.

uveDataSource

1 | uveDataSource *inputDataSource = [[uveDataSourcealloc] initDataSourceWithName:@"inputDataSource" URL:[NSURL URLWithString:@"inputDataSource.xml"]];

2 | inputDataSource.autoLoad = YES;

3 | inputDataSource.autoPurge = NO;

4 | [self.page addGadget:inputDataSource];

Example 2-2: Create uveDataSource object.

The autoload property of the uveDataSource object is set to YES, which means that while the page that contains this dataSource is loaded, a request for the contents of this dataSource will be sent. Also the autoPurge property is set to NO. If this property was YES, the U-verse receiver would purge the dataSource in response to a memory warning.

Next, this example creates an uveActionRefresh object and binds it to the uveDataSource object that was just created by setting the targetControl property to the name property of the uveDataSource (the name argument that was passed to the uveDataSource object on creation). When the uveActionRefresh object is

Page 8: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 4 of 11

triggered,it updates the contents of the controls that are bound to the uveDataSource object, by invoking the ResourceForName callback and refreshing the contents of the controls with the new data in the uveDataSource object that is served to the uvePage. Then the action is added to the page, and using the onKey property of the page, the action is bound to app6. Now when a uveRemoteButtonCommand with app6 is sent to the receiver, the bound action is triggered.

uveActionRefresh

1 | uveActionRefresh *actionRefresh = [[uveActionRefreshalloc] initActionWithName:@"actionRefresh" nameOfTargetControl:@"inputDataSource"];

2 | [self.pageaddAction:actionRefresh];

3 | self.page.onKey = @{@"app6": actionRefresh};

Example 2-3: uveActionRefresh

The following code shows the setup for one of the uveTextBox elements on screen. This is repeated for the uveTextBox element that is used for the animal, color, car, place, food, and drink, just in a different location on screen and with different elements that the flow will follow to. First, this example creates the element with the on-screen location by passing a CGRect for the location. The maximumLines property is set to 1 and then the flow for the element is set up. The nextDown, nextRight, nextUp, and nextLeft properties of the element are set with the name of the element the on-screen focus will move to in response to the user pressing the down, right, up or left buttons on the remote control (the directional pad keys).

uveTextBox

1 | uveTextBox *tvShowTextBox= [[uveTextBoxalloc] i

2 | nitTextBoxWithName:@"tvShowTextBox"

3 | text:@""

4 | frame:CGRectMake(140, 20, 200, 40)];

5 | tvShowTextBox.maximumLines = 1;

6 | tvShowTextBox.nextDown = @"animalTextBox";

7 | tvShowTextBox.nextRight = @"animalTextBox";

8 | tvShowTextBox.nextUp = @"drinkTextBox";

9 | tvShowTextBox.nextLeft = @"drinkTextBox";

Example 2-4: uveTextBox

The next step binds the data source to the element, which is done using the dataSource property of the element. Note that this property takes the uveDataSource object as the argument, and not the name property of the uveDataSource object. The datapath property is set to the path into the XML data that will be supplied through the resourceForName callback. The format starts

Page 9: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 5 of 11

with a leading forward slash for the root of the XML data, followed by the path into the XML data to the required data. This example maps to the name node of the input node of the XML data. Finally, the uveActionRefresh property is set to the onBlur property of the element before adding it to the page, which invokes the resourceForName:withParams: callback each time the user changes focus on the page, and refreshes the page contents.

uveTextBox

1 | tvShowTextBox.datasource = inputDataSource;

2 | tvShowTextBox.datapath = @"/tvShow";

3 | tvShowTextBox.onBlur = actionRefresh;

4 | [self.pageaddGadget:tvShowTextBox];

Example 2-5: uveTextBox

The resourceForName:withParams callback is used to provide a callback to your code any time a resource is requested by the uvePage. The resourceNameproperty identifies which resource is being requested. In the case of this example, it will match the name of the file provided in the NSURL to the uveDataSource object. First an NSString is created along with the XML data that is returned for the data source using the data the user entered in the ViewController’s text fields, which is stored in properties of the ViewController.

Before the data is returned, it is converted from the NSString to a UTF-8 string for the U-verse receiver to understand the format. This is important for any data that you send to the U-verse receiver as the receiver will not be able to decrypt any Cocoa objects. This conversion is done using a convenience method of the NSData class.

uveTextBox

1 | -(NSData *)resourceForName:(NSString *)resourceNamewithParams:(NSMutableDictionary *)params

2 | {

3 | NSLog(@"resourceForName: %@", resourceName);

4 | if ([resourceNameisEqualToString:@"inputDataSource.xml"]){

5 | NSString *xmlInputData = [NSStringstringWithFormat:

6 | @"<input><tvShow>%@</tvShow><animal>%@</animal><color>%@

7 | </color><car>%@</car><place>%@</place><food>

8 | %@</food><drink>%@</drink></input>",

9 | self.tvShow, self.animal, self.color, self.car,

10 | self.place, self.food, self.drink];

11 | NSLog(@"xmlInputData: %@", xmlInputData);

12 | return [xmlInputData dataUsingEncoding:NSUTF8StringEncoding];

13 | }

14 | return nil;

15 | }

Page 10: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 6 of 11

Example 2-6: Converting an NSString to a UTF-8 string.

The final method of the ViewController that is important to discuss is the textFieldShouldEndEditing method. This method is used to update the properties of the ViewController that stores the data. This method is called each time the user completes the editing of one of the textFields in the View Controller. Before this method exits, a uveRemoteButtonCommand is sent with the enum value of the app6 button to invoke the uveActionRefresh on the uvePage. The uveActionRefresh then invokes the resourceForName callback and the textboxes on screen are updated with the data that the user just entered in the ViewController.

textFieldShouldEndEditing

1 | -(BOOL)textFieldShouldEndEditing:(UITextField *)textField

2 | {

3 | if (textField == self.tvShowField){

4 | self.tvShow= self.tvShowField.text;

5 | }

6 | else if (textField == self.animalField){

7 | self.animal= self.animalField.text;

8 | }

9 | else if (textField == self.colorField){

10 | self.color= self.colorField.text;

11 | }

12 | else if (textField == self.carField){

13 self.car= self.carField.text;

14 }

15 else if (textField == self.placeField){

16 self.place= self.placeField.text;

17 }

18 else if (textField == self.foodField){

19 self.food= self.foodField.text;

20 | }

21 | else if (textField == self.drinkField){

22 self.drink= self.drinkField.text;

23 }

24

25 if (self.engagedSTB){

26 uveRemoteButtonCommand *refreshCommand = [[uveRemoteButtonCommandalloc] initWithRemoteKey:RK_app6];

27 [self.engagedSTBsendSetTopBoxCommand:refreshCommand];

28 }

29 return YES;

30 | }

Example 2-7: textFieldShouldEndEditing

Page 11: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 7 of 11

The textFieldShouldBeginEditing and textFieldShouldReturn methods of the UITextFieldDelegate are used to control the layout of the ViewController while the keyboard is displayed. These methods are straightforward, and can be viewed in the Remote Control and TV API UI Example on the sample code page of the AT&T Developer Program web site.

PageForName Method

1 | #define SPACER 10

2 |

3 | #define LABEL_Y_POSITION 20

4 | #define LABEL_X_POSITION 20

5 | #define LABEL_WIDTH 150

6 | #define LABEL_HEIGHT 20

7 |

8 | #define TEXTBOX_X_POSITION 200

9 | #define TEXTBOX_Y_POSTIION 20

10 | #define TEXTBOX_WIDTH 300

11 | #define TEXTBOX_HEIGHT 20

12 |

13 | -(uvePage *)pageForName:(NSString *)pageName withParams:(NSMutableDictionary *)params forFrame:(CGRect)tvFrame

14 | {

15 | if ([pageName isEqualToString:@"main"])

16 | {

17 | self.page = [[uvePage alloc] initPageWithName:@"main"];

18 | CGRect tvShowLabelFrame = CGRectMake(LABEL_X_POSITION, LABEL_Y_POSITION, LABEL_WIDTH, LABEL_HEIGHT);

19 | uveLabel *tvShowLabel = [[uveLabel alloc] initLabelWithName:@"tvShowLabel" text:@"Favorite TV Show:" frame:tvShowLabelFrame];

20 | tvShowLabel.justification = kJustifyRight;

21 | [self.page addGadget:tvShowLabel];

22 | CGRect animalLabelFrame = CGRectMake(LABEL_X_POSITION, LABEL_Y_POSITION + (SPACER + LABEL_HEIGHT), LABEL_WIDTH, LABEL_HEIGHT);

23 | uveLabel *animalLabel = [[uveLabel alloc] initLabelWithName:@"animalLabel" text:@"Favorite Animal:" frame:animalLabelFrame];

24 | animalLabel.justification = kJustifyRight;

25 | [self.page addGadget:animalLabel];

26 |

27 | CGRect colorLabelFrame = CGRectMake(LABEL_X_POSITION, LABEL_Y_POSITION + 2 *(SPACER + LABEL_HEIGHT), LABEL_WIDTH, LABEL_HEIGHT);

28 | uveLabel *colorLabel = [[uveLabel alloc] initLabelWithName:@"colorLabel" text:@"Favorite Color:" frame:colorLabelFrame];

29 | colorLabel.justification = kJustifyRight;

Page 12: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 8 of 11

30 | [self.page addGadget:colorLabel];

31 | CGRect carLabelFrame = CGRectMake(LABEL_X_POSITION, LABEL_Y_POSITION + 3 *(SPACER + LABEL_HEIGHT), LABEL_WIDTH, LABEL_HEIGHT);

32 | uveLabel *carLabel = [[uveLabel alloc] initLabelWithName:@"carLabel" text:@"Favorite Car:" frame:carLabelFrame];

33 | carLabel.justification = kJustifyRight;

34 | [self.page addGadget:carLabel];

35 |

36 | CGRect placeLabelFrame = CGRectMake(LABEL_X_POSITION, LABEL_Y_POSITION + 4 *(SPACER + LABEL_HEIGHT), LABEL_WIDTH, LABEL_HEIGHT);

37 | uveLabel *placeLabel = [[uveLabel alloc] initLabelWithName:@"placeLabel" text:@"Favorite Place:" frame:placeLabelFrame];

38 | placeLabel.justification = kJustifyRight;

39 | [self.page addGadget:placeLabel];

40 |

41 | CGRect foodLabelFrame = CGRectMake(LABEL_X_POSITION, LABEL_Y_POSITION + 5 *(SPACER + LABEL_HEIGHT), LABEL_WIDTH, LABEL_HEIGHT);

42 | uveLabel *foodLabel = [[uveLabel alloc] initLabelWithName:@"foodLabel" text:@"Favorite Food:" frame:foodLabelFrame];

43 | foodLabel.justification = kJustifyRight;

44 | [self.page addGadget:foodLabel];

45 |

46 | CGRect drinkLabelFrame = CGRectMake(LABEL_X_POSITION, LABEL_Y_POSITION + 6 *(SPACER + LABEL_HEIGHT), LABEL_WIDTH, LABEL_HEIGHT);

47 | uveLabel *drinkLabel = [[uveLabel alloc] initLabelWithName:@"drinkLabel" text:@"Favorite Drink:" frame:drinkLabelFrame];

48 | [self.page addGadget:drinkLabel];

49 | uveDataSource *inputDataSource = [[uveDataSource alloc] initDataSourceWithName:@"inputDataSource" URL:[NSURL URLWithString:@"inputDataSource.xml"]];

50 | inputDataSource.autoLoad = YES;

51 | inputDataSource.autoPurge = NO;

52 | [self.page addGadget:inputDataSource];

53 | uveActionRefresh *actionRefresh = [[uveActionRefresh alloc] initActionWithName:@"actionRefresh" nameOfTargetControl:@"inputDataSource"];

54 | [self.page addAction:actionRefresh];

55 | self.page.onKey = @{@"app6": actionRefresh};

56 |

57 | CGRect tvShowTextBoxFrame = CGRectMake(TEXTBOX_X_POSITION, TEXTBOX_Y_POSTIION, TEXTBOX_WIDTH, TEXTBOX_HEIGHT);

58 | uveTextBox *tvShowTextBox = [[uveTextBox alloc] initTextBoxWithName:@"tvShowTextBox" text:@"" frame:tvShowTextBoxFrame];

59 | tvShowTextBox.maximumLines = 1;

Page 13: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 9 of 11

60 | tvShowTextBox.nextDown = @"animalTextBox";

61 | tvShowTextBox.nextRight = @"animalTextBox";

62 | tvShowTextBox.nextUp = @"drinkTextBox";

63 | tvShowTextBox.nextLeft = @"drinkTextBox";

64 | tvShowTextBox.datasource = inputDataSource;

65 | tvShowTextBox.datapath = @"/input/tvShow";

66 | [self.page addGadget:tvShowTextBox];

67 | tvShowTextBox.onBlur = actionRefresh;

68 |

69 | CGRect animalTextBoxFrame = CGRectMake(TEXTBOX_X_POSITION, TEXTBOX_Y_POSTIION + (SPACER + TEXTBOX_HEIGHT), TEXTBOX_WIDTH, TEXTBOX_HEIGHT);

70 | uveTextBox *animalTextBox = [[uveTextBox alloc] initTextBoxWithName:@"animalTextBox" text:@"" frame:animalTextBoxFrame];

71 | animalTextBox.nextDown = @"colorTextBox";

72 | animalTextBox.nextRight = @"colorTextBox";

73 | animalTextBox.nextUp = @"tvShowTextBox";

74 | animalTextBox.nextLeft = @"tvShowTextBox";

75 | animalTextBox.datasource = inputDataSource;

76 | animalTextBox.datapath = @"/input/animal";

77 | [self.page addGadget:animalTextBox];

78 | animalTextBox.onBlur = actionRefresh;

79 |

80 | CGRect colorTextBoxFrame = CGRectMake(TEXTBOX_X_POSITION, TEXTBOX_Y_POSTIION + 2 * (SPACER + TEXTBOX_HEIGHT), TEXTBOX_WIDTH, TEXTBOX_HEIGHT);

81 | uveTextBox *colorTextBox = [[uveTextBox alloc] initTextBoxWithName:@"colorTextBox" text:@"" frame:colorTextBoxFrame];

82 | colorTextBox.maximumLines = 1;

83 | colorTextBox.nextDown = @"carTextBox";

84 | colorTextBox.nextRight = @"carTextBox";

85 | colorTextBox.nextUp = @"animalTextBox";

86 | colorTextBox.nextLeft = @"animalTextBox";

87 | colorTextBox.datasource = inputDataSource;

88 | colorTextBox.datapath = @"/input/color";

89 | [self.page addGadget:colorTextBox];

90 | colorTextBox.onBlur = actionRefresh;

91 |

92 | CGRect carTextBoxFrame = CGRectMake(TEXTBOX_X_POSITION, TEXTBOX_Y_POSTIION + 3 * (SPACER + TEXTBOX_HEIGHT), TEXTBOX_WIDTH, TEXTBOX_HEIGHT);

93 | uveTextBox *carTextBox = [[uveTextBox alloc] initTextBoxWithName:@"carTextBox" text:@"" frame:carTextBoxFrame];

94 | [self.page addGadget:carTextBox];

95 | carTextBox.maximumLines = 1;

96 | carTextBox.nextDown = @"placeTextBox";

97 | carTextBox.nextRight = @"placeTextBox";

98 | carTextBox.nextUp = @"colorTextBox";

Page 14: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 10 of 11

99 | carTextBox.nextLeft = @"colorTextBox";

100 | carTextBox.datasource = inputDataSource;

101 | carTextBox.datapath = @"/input/car";

102 | carTextBox.onBlur = actionRefresh;

103 |

104 | CGRect placeTextBoxFrame = CGRectMake(TEXTBOX_X_POSITION, TEXTBOX_Y_POSTIION + 4 * (SPACER + TEXTBOX_HEIGHT), TEXTBOX_WIDTH, TEXTBOX_HEIGHT);

105 | uveTextBox *placeTextBox = [[uveTextBox alloc] initTextBoxWithName:@"placeTextBox" text:@"" frame:placeTextBoxFrame];

106 | placeTextBox.maximumLines = 1;

107 | placeTextBox.nextDown = @"foodTextBox";

108 | placeTextBox.nextRight = @"foodTextBox";

109 | placeTextBox.nextUp = @"carTextBox";

110 | placeTextBox.nextLeft = @"carTextBox";

111 | placeTextBox.datasource = inputDataSource;

112 | placeTextBox.datapath = @"/input/place";

113 | [self.page addGadget:placeTextBox];

114 | placeTextBox.onBlur = actionRefresh;

115 |

116 | CGRect foodTextBoxFrame = CGRectMake(TEXTBOX_X_POSITION, TEXTBOX_Y_POSTIION + 5 * (SPACER + TEXTBOX_HEIGHT), TEXTBOX_WIDTH, TEXTBOX_HEIGHT);

117 | uveTextBox *foodTextBox = [[uveTextBox alloc] initTextBoxWithName:@"foodTextBox" text:@"" frame:foodTextBoxFrame];

118 | foodTextBox.maximumLines = 1;

119 | foodTextBox.nextDown = @"postcodeTextBox";

120 | foodTextBox.nextRight = @"postcodeTextBox";

121 | foodTextBox.nextUp = @"placeTextBox";

122 | foodTextBox.nextLeft = @"placeTextBox";

123 | foodTextBox.datasource = inputDataSource;

124 | foodTextBox.datapath = @"/input/food";

125 | [self.page addGadget:foodTextBox];

126 | foodTextBox.onBlur = actionRefresh;

127 |

128 | CGRect drinkTextBoxFrame = CGRectMake(TEXTBOX_X_POSITION, TEXTBOX_Y_POSTIION + 6 * (SPACER + TEXTBOX_HEIGHT), TEXTBOX_WIDTH, TEXTBOX_HEIGHT);

129 | uveTextBox *drinkTextBox = [[uveTextBox alloc] initTextBoxWithName:@"drinkTextBox" text:@"" frame:drinkTextBoxFrame];

130 | drinkTextBox.maximumLines = 1;

131 | drinkTextBox.nextDown = @"nameTextBox";

132 | drinkTextBox.nextRight = @"nameTextBox";

133 | drinkTextBox.nextUp = @"foodTextBox";

134 | drinkTextBox.nextLeft = @"foodTextBox";

135 | drinkTextBox.datasource = inputDataSource;

136 | drinkTextBox.datapath = @"/input/drink";

137 | [self.page addGadget:drinkTextBox];

Page 15: AT&T U verse® Enabled...example displays a view Controller with a number of text fields for the user to enter their address information, and then updates the content on the screen

© 2013 AT&T Intellectual Property. All rights reserved. AT&T and the AT&T logo are trademarks of AT&T Intellectual Property.

Page 11 of 11

138 | drinkTextBox.onBlur = actionRefresh;

139 |

140 | return self.page;

141 | }

142 | else {

143 | return nil;}

144 | }

145 | }

Example 2-8: PageForName Method