Objective c 如何在Apple Watch的应用程序中显示标签
我已经通过api在iOS应用程序中更改了标签。它成功地改变了。现在我想在Apple Watch label中显示此标签值。Objective c 如何在Apple Watch的应用程序中显示标签,objective-c,uilabel,watchkit,Objective C,Uilabel,Watchkit,我已经通过api在iOS应用程序中更改了标签。它成功地改变了。现在我想在Apple Watch label中显示此标签值。 我试着用InterfaceController*ic和alloc&init这样做,然后在我的api获得成功的地方,我正在做ic.myLabel.text=[NSString stringWithFormat:@“%@,[tempDict objectForKey:@“summary”],因此它不起作用。有什么线索吗?您可以从iOS应用程序请求数据。 需要在Watch App
我试着用
InterfaceController*ic
和alloc&init
这样做,然后在我的api获得成功的地方,我正在做ic.myLabel.text=[NSString stringWithFormat:@“%@,[tempDict objectForKey:@“summary”]代码>
,因此它不起作用。有什么线索吗?您可以从iOS应用程序请求数据。
需要在Watch App中实现此方法:
[WKInterfaceController openParentApplication:@{@"KEY":@"getValue"}
reply:^(NSDictionary *replyInfo, NSError *error) {
[self updateLabelWithString:replyInfo(@"value")];
}];
在iOS应用程序AppDelegate中:
- (void)application:(UIApplication *)applicationhandleWatchKitExtensionRequest:(NSDictionary *)userInfo
reply:(void (^)(NSDictionary *replyInfo))reply
{
reply(@{@"value":@"your data"});
}
应用程序代理使用提供的字典执行请求,然后向WatchKit扩展返回回复。您可以从iOS应用程序请求数据。
需要在Watch App中实现此方法:
[WKInterfaceController openParentApplication:@{@"KEY":@"getValue"}
reply:^(NSDictionary *replyInfo, NSError *error) {
[self updateLabelWithString:replyInfo(@"value")];
}];
在iOS应用程序AppDelegate中:
- (void)application:(UIApplication *)applicationhandleWatchKitExtensionRequest:(NSDictionary *)userInfo
reply:(void (^)(NSDictionary *replyInfo))reply
{
reply(@{@"value":@"your data"});
}
应用程序代理使用提供的字典执行请求,然后向WatchKit扩展返回回复。您可以从iOS应用程序请求数据。
需要在Watch App中实现此方法:
[WKInterfaceController openParentApplication:@{@"KEY":@"getValue"}
reply:^(NSDictionary *replyInfo, NSError *error) {
[self updateLabelWithString:replyInfo(@"value")];
}];
在iOS应用程序AppDelegate中:
- (void)application:(UIApplication *)applicationhandleWatchKitExtensionRequest:(NSDictionary *)userInfo
reply:(void (^)(NSDictionary *replyInfo))reply
{
reply(@{@"value":@"your data"});
}
应用程序代理使用提供的字典执行请求,然后向WatchKit扩展返回回复。您可以从iOS应用程序请求数据。
需要在Watch App中实现此方法:
[WKInterfaceController openParentApplication:@{@"KEY":@"getValue"}
reply:^(NSDictionary *replyInfo, NSError *error) {
[self updateLabelWithString:replyInfo(@"value")];
}];
在iOS应用程序AppDelegate中:
- (void)application:(UIApplication *)applicationhandleWatchKitExtensionRequest:(NSDictionary *)userInfo
reply:(void (^)(NSDictionary *replyInfo))reply
{
reply(@{@"value":@"your data"});
}
应用程序代理使用提供的字典执行请求,然后向WatchKit扩展返回回复。您要在哪里更改标签?在你的手表套件分机里?你不能直接从iOS应用程序执行。是的,完全正确。那我该怎么做?你想在哪里更改标签?在你的手表套件分机里?你不能直接从iOS应用程序执行。是的,完全正确。那我该怎么做?你想在哪里更改标签?在你的手表套件分机里?你不能直接从iOS应用程序执行。是的,完全正确。那我该怎么做?你想在哪里更改标签?在你的手表套件分机里?你不能直接从iOS应用程序执行。是的,完全正确。那么我该怎么做呢?如果WatchKit应用程序当前正在运行,您还可以考虑使用Darwin通知立即通知它。请查看MMWormhole以简化此操作:@bgilham似乎很棒。让我试一试。如果WatchKit应用程序当前正在运行,您还可以考虑使用Darwin通知立即通知它。请查看MMWormhole以简化此操作:@bgilham似乎很棒。让我试一试。如果WatchKit应用程序当前正在运行,您还可以考虑使用Darwin通知立即通知它。请查看MMWormhole以简化此操作:@bgilham似乎很棒。让我试一试。如果WatchKit应用程序当前正在运行,您还可以考虑使用Darwin通知立即通知它。请查看MMWormhole以简化此操作:@bgilham似乎很棒。让我试一试。