-1

我试图在情节提要上将 UIViewController 指定为我自己的自定义类 SimpleSafariViewController。编译器不允许我重写 init() 方法来预加载http://news.google.com

编译错误是“重写 init 方法不可用”如果编译器允许我,我将有以下代码

SimpleSafariViewController
    convenience init() {
        super.init(URL: URL("http://news.google.com"), entersReaderIfAvailable: true)
    }

如果是这样,那么是否有另一种方法来解决这个问题。

我在github上发布了最简单的项目

https://github.com/joshuacalloway/SimpleSafari

斯威夫特 2.1,xcode 7.2

4

1 回答 1

0

您没有像建议的那样使用 SFSafariViewController 。它并不意味着作为您 StoryBoard 上的 ViewController。中的实现SuggestedSafariViewController是正确的方法。(同意@matt)

于 2016-03-01T01:57:53.413 回答