首页 文章

UITextField中的WKWebView自动完成建议

提问于
浏览
0

我使用WKWebview来显示网页,并有一个UITextField,用户可以在其中输入他们希望导航到的URL(应用程序内浏览器) . 当用户打字时,我想显示一系列可能性(即热门网站) . 是否有任何Apple(或第三方)API可用于根据子字符串获取热门网站列表?

编辑:我需要使用WKWebView而不是新的Safari View Controller,因为我希望能够注入自定义的javascript(前者不允许)

1 回答

  • 1

    Use this URL for auto complete

    http://suggestqueries.google.com/complete/search?client=chrome&q=YOURQUERY

    喜欢

    搜索?客户=铬&Q =苹果

    Use TableView For Showing the suggestions.

    - (IBAction)act_search:(id)sender {
        if([_txt_search.text length] > 2)
        {
    
            Code Here ...
    
            [_tableview reloadData];
    
    
        }
        else
        {
            jsonarr = nil;
            [_tableview reloadData];
        }
    
    
    }
    

相关问题