我在用着Parse
创建此表视图,并且我正在尝试弄清楚如何获取表数据,以便我可以将其传递到 WatchKit InterfaceController
.
(我是否需要查询Parse
以某种方式获取数据并将其存储在array
然后我就可以从 WatchKit 调用它InterfaceController
awakeWithContext
?)
这是我所拥有的,如果我可以添加任何有用的内容,请告诉我:
TableVC.m
:
- (id)initWithCoder:(NSCoder *)aCoder
{
self = [super initWithCoder:aCoder];
if (self) {
self.parseClassName = @"na";
self.textKey = @"dateTime";
self.pullToRefreshEnabled = YES;
self.paginationEnabled = NO;
}
return self;
}
- (PFQuery *)queryForTable
{
PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];
return query;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
{
static NSString *simpleTableIdentifier = @"RecipeCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
UILabel *homeLabel = (UILabel*) [cell viewWithTag:101];
homeLabel.text = [object objectForKey:@"test"];
UILabel *dateLabel = (UILabel*) [cell viewWithTag:102];
dateLabel.text = [object objectForKey:@"dateTime"];
return cell;
}
Parse
data:
![enter image description here](https://i.stack.imgur.com/Eeayh.png)
TableVC
:
![enter image description here](https://i.stack.imgur.com/ERdRS.png)
我有基本的WKInterfaceTable
设置完毕,我所需要做的就是让它显示与TableVC.m
.
所以我陷入困境的是我知道我需要某种数组WKInterfaceTable
使用,但在我的TableVC.m
我在哪里使用Parse
我不知道如何/做什么才能实现这一点。看来我可能会在 viewDidLoad 中执行解析查询来提取相同的对应内容test
and dateTime
用于在WKInterfaceTable
,但我不确定?
在 WatchKit 扩展中,您需要以不同的方式设置表。在 iOS 上,UITableView 根据单元格的需要查询数据源。在 WatchKit 上,您需要一次将表的所有数据传递给您WKInterfaceTable
。我不会在这里详细介绍如何设置表格,因为您可以在这里找到一些很棒的信息https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/Tables.html.
另外,我建议您在后台执行解析查询,然后在数据返回后更新表。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)