如何在UISearchController中使用自定义视图控制器获取结果?

时间:2018-02-01 18:50:09

标签: ios iphone swift search uisearchcontroller

我目前正在尝试为应用实施搜索功能。目标是在不同的视图控制器中显示搜索结果。我的意思是:

UISearchController(searchResultsController: myCustomViewControllerHere)

我在教程中找到的所有答案都使用当前视图控制器和数据作为视图控制器来显示结果:

UISearchController(searchResultsController: nil)

有人可以帮忙解决一下如何做到这一点吗?我链接了一个教程,它在同一个VC上显示结果

Tutorial Link

1 个答案:

答案 0 :(得分:2)

您需要创建一个SearchController并将其设置为在另一个TableViewController中显示结果:

的ViewController

C:\name\pjt Testing\AutomationProt\IO Sample>protractor
(node:11848) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() i
ead.
[08:49:59] W/driverProviders - Using driver provider directConnect, but also
nd extra driver provider parameter(s): seleniumAddress
[08:49:59] I/launcher - Running 1 instances of WebDriver
[08:49:59] I/direct - Using ChromeDriver directly...

DevTools listening on ws://127.0.0.1:12503/devtools/browser/0472e62f-7d84-463
014-ab0080c3ff0d
Jasmine started
Beforeall Started
 Beforeall ended
[08:50:16] I/protractor -
[08:50:16] I/protractor - Encountered browser.pause(). Attaching debugger...
[08:50:16] I/protractor -
[08:50:16] I/protractor - ------- WebDriver Debugger -------
[08:50:16] I/protractor - Starting WebDriver debugger in a child process. Pau
is still beta, please report issues at github.com/angular/protractor
[08:50:16] I/protractor -
[08:50:16] I/protractor - press c to continue to the next webdriver command
[08:50:16] I/protractor - press ^D to detach debugger and resume code executi
[08:50:16] I/protractor -
Starting debugger agent.
(node:11848) DeprecationWarning: node --debug is deprecated. Please use node
nspect instead.
Debugger listening on 127.0.0.1:10000
>>> c[10996:11420:0201/085204.362:ERROR:process_metrics.cc(105)] NOT IMPLEMEN

[10996:11420:0201/085204.362:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[10996:11420:0201/085204.362:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[10996:11420:0201/085204.363:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[10996:11420:0201/085204.363:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED

c
-- Next command: findElements
>>> -- Next command: findElements
>>> c
-- Next command: clickElement
>>> c
-- Next command: findElements
>>> cf
Unrecognized command.
>>> c
-- Next command: sendKeysToElement
>>>
(To exit, press ^C again or type .exit)
>>> [10996:11420:0201/085404.281:ERROR:process_metrics.cc(105)] NOT IMPLEMENT
[10996:11420:0201/085404.281:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[10996:11420:0201/085404.281:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[10996:11420:0201/085404.281:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[10996:11420:0201/085404.281:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED

ResultsTableViewController

{{1}}

希望它有所帮助。

Oracle SQL Developer Data Modeler