![]() ![]() Each table row controller is responsible for managing their type of row.Ĭlick on the first Table Row Controller and in the Attributes inspector for Identifier type LightbulbAccessoryRow. Notice that there are now two Table Row Controllers. Now, we’ve established that we want two types of rows and we currently only have one, so click on the Attributes inspector for the table (not the row controller) and set the Rows value to 2: ![]() The table row controller implementation is in the extension (in this first iteration of WatchKit it should pointed out that implementation is always in the extension) and is a separate Swift class. If you have one more than one type of row you will have more than one row controller. The Table in WatchKit is the UI component which will manage the rows, and the row controller will manage the display of a type of row. In the screenshot above note that the Interface Controller contains a Table, and that Table contains a Table Row Controller. We’re going to stop and make the distinction now between a table and a row in WatchKit. After this step your watch interface should look like this: Note that the description for a WKInterfaceTable says “Displays one or more rows of data”. The other row type will contain a label and two buttons to increase and decrease the setpoint temperature on a thermostat.īring up your Watch App Interface.storyboard and drag and drop a Table onto the watch canvas. One row type will contain a lightbulb image and a button to toggle it on and off. We’re going to create a table with two types of rows. Home automation control is all about controlling accessories, and what better way to quickly view all of your accessories than with a table? WatchKit provides a table UI element with WKInterfaceTable. ![]() Open the watchkittables.xcodeproj project in Xcode 6.2 or higher (this is the first version with iOS 8.2 and WatchKit). ![]() Our starter app already has an Apple Watch target provided and supplementary images. Let’s get started! Head on over to Bitbucket and download the starter app. Bring up your Apple Watch, open your home automation app, and press Unlock. The Apple Watch interface will lend itself well to controlling home automation devices as it will eliminate things like digging your phone out of your pocket to unlock the door. If you’ve been following or reading this blog for any period of time you will know that we’re passionate about home automation controls, and look forward to HomeKit in the market. [self.table setNumberOfRows:myResults.Today we’re going to show you how to use a WKInterfaceTable in your Apple Watch applications. Self.objects = count: %lu", (unsigned long)unt) NSManagedObject *object = initWithEntity:entity insertIntoManagedObjectContext:managedContext] NSManagedObjectContext * managedContext = context] #import InterfaceController : (strong, nonatomic) IBOutlet WKInterfaceTable (strong, nonatomic) NSArray #import "InterfaceController.h" And although that seems to be working fine in the watch extension based on the debug logs, I am not getting any data in the watch table when I run the app on the watch. I have the app group in place, and created a core data class that both the app and the watch extension can access. So I basically tried to use the code I have in my app tableviewcontroller modified for the watch extension. I have a published app and now I want to build in a watch extension that will just present a table on the watch populated with data from my core data store. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |