如何创建两个WkWebView [英] How to Create Two WkWebView

查看:99
本文介绍了如何创建两个WkWebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用两个WKWebView创建一个iPhone应用程序, 一个用于标题,另一个用于容器.如何创建它们?

I am trying to create an iPhone app with two WKWebView, one for a header and one for a container. How can I create them?

我在Xcode/Interface Builder中找不到任何实用程序来创建WKWebview实例.我可以创建UIWebView类型的WebView,但是无法在其上调用WkWebView方法,也无法将其转换为WKWebview.

I can't find any utility in Xcode/Interface Builder to create WKWebview instances. I can create a WebView which is of type UIWebView, but I can't call WkWebView methods on it and I can't conversion it to a WKWebview.

推荐答案

var item = WKWebView()
item.frame = CGRectMake(0, 0,
        self.view.bounds.width, 200.)
self.view.addSubview(item)

item = WKWebView()
item.frame = CGRectMake(0, self.view.bounds.height-200.,
        self.view.bounds.width, 200.)
self.view.addSubview(item)

此代码在self.view的顶部和底部添加WKWebView.

This code add WKWebView at the top and bottom of self.view.

这篇关于如何创建两个WkWebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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