小编dub*_*dub的帖子

在tvos中更改焦点时如何在UISearchController中关闭键盘?

我是tvos的新手,我正在尝试实现一个UISearchController视图,在我的SearchResultsViewController中,我有两个UICollectionViews一个显示在另一个上面: 在此输入图像描述

问题是当用户向下滑动以选择UICollectionView中的一个项目时,键盘不会被忽略.即使向上滑动以选择键盘也无法完全向上滚动,因此无法看到您正在键入的内容.结果视图是这样的: 在此输入图像描述

理想情况下,当用户向下滑动以关注界面中的任何其他内容时,我想关闭键盘.我查看了Apple的tvos UIKit目录,他们的示例显示了一个UISearchController,它在更改焦点时解除了键盘,但我没有看到他们正在做任何不同的事情.

这是我用来点击按钮时设置我的UISearchController的代码:

@IBAction func onSearchButton(sender: AnyObject) {
    guard let resultsController = storyboard?.instantiateViewControllerWithIdentifier(SearchResultsViewController.storyboardID) as? SearchResultsViewController else { fatalError("Unable to instantiate a SearchResultsViewController.") }

    // Create and configure a `UISearchController`.
    let searchController = UISearchController(searchResultsController: resultsController)
    searchController.searchResultsUpdater = resultsController
    searchController.hidesNavigationBarDuringPresentation = false

    let searchPlaceholderText = NSLocalizedString("Search for a Show or Movie", comment: "")
    searchController.searchBar.placeholder = searchPlaceholderText

    // Present the search controller from the root view controller.
    guard let rootViewController = view.window?.rootViewController else { fatalError("Unable to get root view …
Run Code Online (Sandbox Code Playgroud)

swift uisearchcontroller tvos

7
推荐指数
1
解决办法
1625
查看次数

AngularJS:捕获生产中的错误堆栈

我在AngularJS上运行我的站点并使用New Relic JS错误通知来检测错误.

我想修复重大错误,基本上做了.但我无法重现可以在网站的任何页面上记录的一个错误:

Stack trace
UncaughtException: Script error.
    in evaluated code
Run Code Online (Sandbox Code Playgroud)

我尝试使用相同的浏览器访问这些页面,使用低速连接,在Mac,Windows,Ubuntu上记录New Relic.但它没有意义.

所以,我的问题是有什么技术可以帮助我捕获这个错误或扩展它的信息?它可以是常见的JS技术或AngularJS特有的.

error-handling newrelic angularjs

5
推荐指数
1
解决办法
883
查看次数

AngularJS路线助手

任何有关如何构建解决方案的想法,有助于以更方便的方式在视图中生成URL,而不是像这样的硬编码:

<a ng-href="#/Book/{{item.bookId}}/ch/{{item.id}}">Chapter {{item.id}}</a>
Run Code Online (Sandbox Code Playgroud)

我想用:

<a chapters="[item.bookId, item.id]">Chapter {{item.id}}</a>
Run Code Online (Sandbox Code Playgroud)

因此它检查路由并为每个路由特定指令生成.

我对尽可能最通用的解决方案感兴趣.

angularjs angularjs-routing

4
推荐指数
1
解决办法
5676
查看次数