我正試圖在WatchKit上創建一個表。由於某些原因,該應用在WatchKit中啓動時只是空白。我已經確認這是一個表格問題(我添加了一個靜態標籤,並能夠看到它)。我相信我也擁有所有IBOutlets。我究竟做錯了什麼?WatchKit表空白
我有我的InterfaceController.h下面的代碼:
@interface InterfaceController : WKInterfaceController {
NSMutableArray *listArray;
}
@property (weak, nonatomic) IBOutlet WKInterfaceTable *playlistTable;
InterfaceController.m:
- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
// Configure interface objects here.
listArray = [[NSMutableArray alloc] initWithObjects:@"Hello", @"Watch", @"World", nil];
[self setupTable];
}
- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
[super willActivate];
}
- (void)didDeactivate {
// This method is called when watch view controller is no longer visible
[super didDeactivate];
}
- (void)setupTable {
[self.playlistTable setRowTypes:listArray];
for (int i = 0; i < self.playlistTable.numberOfRows; i++)
{
universalRow *row = [self.playlistTable rowControllerAtIndex:i];
[row.mainTitle setText:[listArray objectAtIndex:i]];
[row.subtitleLabel setText:@"subtitle!"];
}
}
和NSObject的行級 'universalRow':
@interface universalRow : NSObject {
}
@property (nonatomic, weak) IBOutlet WKInterfaceLabel *mainTitle;
@property (nonatomic, weak) IBOutlet WKInterfaceLabel *subtitleLabel;
@end