查看WatchKit表上的分析数据



我正在尝试让我的应用程序在WatchKit上运行。我使用Parse,并希望简单地将PFObject中的"Request"值显示为WatchKit表中的一行。我已经设置了表和行,行NSObject类中只有一个标签,其中将填充"Request"字段。这是我的手表界面控制器中的内容。

#import "InterfaceController.h"
#import "TheTable.h"
#import <Parse/Parse.h>
#import "BlogView.h"
@interface InterfaceController()
@property (nonatomic, retain) PFObject *theObject;
@property (nonatomic, retain)     NSMutableArray *rowTypesList;
@end

@implementation InterfaceController
- (void)awakeWithContext:(id)context {
    [Parse setApplicationId:@"MYID"
                  clientKey:@"MYKEY"];
    [super awakeWithContext:context];
    // Configure interface objects here.
}
- (void)willActivate
{
    PFQuery *query = [PFQuery queryWithClassName:@"Prayers"];
    // If no objects are loaded in memory, we look to the cache first to fill the table
    // and then subsequently do a query against the network.

    [query orderByDescending:@"createdAt"];

    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {
            NSArray *array = [objects objectAtIndex:0];//Selects the first "object" from all the "objects"
            array = [array valueForKey:@"Request"];//Makes a NSArray from the "pairs" values
            _rowTypesList = [array mutableCopy];//Converts the array to a NSMutableArray
            NSLog(@"%@",  _rowTypesList);
        } else {
            // Log details of the failure
            NSLog(@"Error: %@ %@", error, [error userInfo]);
        }
    }];    [self setupTable];
}
- (void)setupTable
{
    NSLog(@"%@", _rowTypesList);
    [_theActualTable setRowTypes:_rowTypesList];
    for (NSInteger i = 0;_theActualTable.numberOfRows; i++)
    {
        NSObject *row = [_theActualTable rowControllerAtIndex:i];
            TheTable *importantRow = (TheTable *) row;
            [importantRow.textRowLabel setText:???]; //THIS IS PROBLEM AREA, HOW DO I GET TEXT HERE FROM THE MUTABLEARRAY
    }
}
@end

如何将该行的值从数组中获取到标签中?

我对目标C不太了解,但我有一个想法。您需要从ParseQuery回调调用setupTable并将结果数组传递给它,或者在回调中迭代该数组并在每次迭代中调用mytable.label.setText(array[i]["property"])

希望它有意义。

相关内容

  • 没有找到相关文章

最新更新