2017-02-23 7 views
0

をWebViewの中のURLやロック付きのボックスを作成します。 enter image description hereこの(IOSサファリ)のようになめらか私は私のWebViewの最上部に追加したい、IOS

私は、私は、TextFieldとシンプルなボタンを追加することができます知っているが、私はどのようにURL文字列の先頭にあるロックを作成するか分からない。 Plaeseは私に助言を与える。

+0

方法について: google.com – rmaddy

+0

@rmaddyそれは私の最初のアイデアでしたが、Webサイトにセキュリティで保護されたアクセスがない場合は? – Burning

+0

その後、ロックを表示しないでください。 – rmaddy

答えて

1

1週間後、わかった! :) SFSafariViewControllerは、AndroidのChromeカスタムタブに類似しています。 例:ボタンの

import SafariServices 

コード:

let bookmark = NSURL(string: "http://www.apple.com")! 
let safari = SFSafariViewController(URL: bookmark) 
presentViewController(safari, animated: true, completion: nil) 

アニメーションを却下する:

func safariViewControllerDidFinish(controller: SFSafariViewController) { 
    controller.dismissViewControllerAnimated(true, completion: nil) 
} 

スウィフト4

let bookmark = NSURL(string: "http://www.apple.com")! 
let safari = SFSafariViewController(url: bookmark as URL) 
present(safari, animated: true, completion: nil) 
//... 
func safariViewControllerDidFinish(controller: SFSafariViewController) { 
    controller.dismiss(animated: true, completion: nil) 
} 
関連する問題