![]() The identifier is configured by selecting the row controller item in the Document Outline panel and entering a suitable identifier name into the Identifier field of the Attributes Inspector panel:Īssociating a Row Controller with a Row Controller Classīefore the table can be displayed, the row controller in the scene needs to be associated with the corresponding row controller class residing within the extension. The row controller template must also be assigned an identifier which will be referenced in the interface controller code when instances of that row type are created during initialization. Any attributes set within the storyboard will serve as the default attributes for the visual elements and will appear in the app at runtime unless overridden in the interface controller. It is important to be aware that the appearance of the visual elements in a row is generally defined at runtime by the interface controller using the outlines declared in the row controller class. In Figure 6-4, for example, the template row controller contains an image and label: To design the row, simply drag and drop user interface objects from the Object Library onto the row and resize the items to achieve the desired layout. The row controller within the table is a template for the row controllers that will be created within the interface controller. This enables us, for example, to see that a scene consists of a Table, Table Row Controller and a Group object: When displayed, the document outline shows a hierarchical overview of the elements that make up a user interface layout. This panel appears by default to the left of the Interface Builder panel and is controlled by the small button in the bottom left hand corner (indicated by the arrow in Figure 6-2) of the Interface Builder panel. The hierarchical structure of the table and table row controller can be viewed within the Xcode Document Outline panel. Figure 6 1 shows a scene with a newly added table with the default row controller: A Group object is a single user interface element that can contain one or more interface objects in a horizontal or vertical arrangement. By default, the table instance will contain a single row controller instance containing a Group object. Implementing a Table in a WatchKit App SceneĪ Table is added to a WatchKit scene by dragging and dropping a Table object from the Object Library onto the storyboard scene. Table based navigation will then be explored in the A WatchKit Table Navigation Tutorial chapter of the book. The next chapter, entitled A WatchKit Table Tutorial, will then work through the creation of an example WatchKit table scene. This chapter will provide an overview of tables in WatchKit, exploring how tables are structured and explaining areas such as the WKInterfaceTable class, row controllers, row controller classes, row controller types and the steps necessary to initialize a WatchKit table at runtime. Tables can be used purely as a mechanism for displaying lists of information, or used to implement navigation whereby the selection of a particular row within a table triggers a transition to another scene within the storyboard. The WatchKit Table object allows content to be displayed within a WatchKit app scene in the form of a single vertical column of rows. WatchOS 2 App Development Essentials Print and eBook (ePub/PDF/Kindle) editions contain 35 chapters. Purchase the fully updated watchOS 2/Swift 2 edition of this book in eBook ($12.99) or Print ($27.99) format ![]()
0 Comments
Leave a Reply. |