NEWBIE可以使用我自己的SFSafariViewController并预加载一个url。然后在故事板上使用它

问题描述:

我想在故事板上将UIViewController指定为我自己的自定义类SimpleSafariViewController。编译器不会让我重写init()方法来预加载http://news.google.comNEWBIE可以使用我自己的SFSafariViewController并预加载一个url。然后在故事板上使用它

编译错误是“init()方法的覆盖不可用” 如果编译器让我,我会在下面的代码

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

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

我已经发布在GitHub上

https://github.com/joshuacalloway/SimpleSafari

SWIFT 2.1时,Xcode 7.2

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

+0

为什么它不是要坐在Storyboard上? – jcalloway

+0

为什么suggestsafari是正确的方法? – jcalloway