WatchKit是否支持html?是否有类似UIWebview的控制器? [英] Does WatchKit support html? is there is controller like UIWebview?

查看:56
本文介绍了WatchKit是否支持html?是否有类似UIWebview的控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WatchKit是否支持html?是否有类似UIWebview的控制器?

Does WatchKit support html? is there is controller like UIWebview ?.

我的客户想要在Apple Watch中显示网页.这可能吗?

My client want to show webpage in a Apple Watch. is this possible ?

推荐答案

WatchKit中没有UIWebView(WatchOS 1WatchOS 2都没有).

There's no UIWebView in WatchKit (neither WatchOS 1 nor WatchOS 2).

但是,完全有可能解决此问题:

However, it's fully possible to work around this:

您可以加载HTML,选择相关内容,然后以例如Label的形式显示.但是,这不是一个明智的解决方案,因为网站所有者可以更改其布局并在更新之前使您的应用无用.

You can load the HTML, pick out the relevant content, and display that in for example a Label. This is however not a smart solution, as the website owners can change its layout and render your app useless until you update it.

我的建议是将GET请求发送到服务器,并以JSON格式接收相关数据(如果它们具有API).如果没有,您可以使用和服之类的服务将网站转换为API.

My suggestion is to send a GET-request to the server and receive the relevant data in JSON-format if they have an API. If they don't, you can use a service such as Kimono to convert the website into an API.

或者您可以设置自己的服务器作为API.您只需向其发送请求,它查询网站/加载HTML,然后将相关内容返回给您的应用.

Or you could set up your own server which works as the API. You simply send a request to it, it queries the website/ loads the HTML, and returns the relevant content to your app.

无论如何,解决方案是从网站上获取相关内容并使用标签和图像视图进行显示.

In any case, the solution is to get the relevant content from the website and display that using labels and image views.

这篇关于WatchKit是否支持html?是否有类似UIWebview的控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆