当我尝试使用以下代码启动Apple Watch应用程序时,它会在日志打印后崩溃并生成" (之后什么也没有)。当我删除代码时,它不会崩溃。我无法弄清楚可能出现的问题。
NSMutableArray *rowTypesList = himo; //himo is a nsmutablearray that contains info from NSXMLParser
[_table setRowTypes:rowTypesList];
for (NSInteger i = 0; i < _table.numberOfRows; i++)
{
NSDictionary *itemAtIndex =(NSDictionary *)[himo objectAtIndex:i];
NSObject *row = [_table rowControllerAtIndex:i];
Cell *importantRow = (Cell *) row;
[importantRow.label setText:@"hi"];
}
NSLog(@"produce");
答案 0 :(得分:0)
看起来您要将要显示在表中的数据与行控制器类型混合使用。如果您只有一个单行控制器类型的Cell,您可以通过代码执行以下操作:
[_table setNumberOfRows:[himo count] withRowType:@"theIdentiferYouGaveTheRowControllerInTheStoryboard"];
for (NSInteger i = 0; i < [himo count]; i++) {
NSDictionary *item = (NSDictionary *)[himo objectAtIndex:i];
Cell *rowController = [_table rowControllerAtIndex:i];
[rowController.label setText:@"hi"]; // you probably want to use the data from item here
}