相关疑难解决方法(0)

视图显示为模态视图动画而不是显示(推)动画

我最近将我的应用程序从iOS 8.3更新到iOS 9.在使用代码修复各种错误后,我设法编译应用程序并运行它,当我注意到以下问题.

当我执行segue点击时,例如,UIButton,加载了segue的视图会出现一个模态视图的动画(从底部滑动直到它到达顶部),但在故事板中,segue是Show (e.g. Push).此外,导航控制器的后退按钮不再出现.

控制台在执行segue时打印出来:

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7ffde14866b0>)

这个问题似乎只出现在一个视图中,当加载其他视图时,我试图将其他视图设置为初始视图控制器并且所有视图都有效.

ios swift swift2

11
推荐指数
1
解决办法
7259
查看次数

UISearchController - 警告尝试加载视图控制器的视图

我收到以下错误.

尝试在取消分配时加载视图控制器的视图是不允许的,并且可能导致未定义的行为()

尝试了以下解决方案,但对我不起作用尝试在取消分配时加载视图控制器的视图... UISearchController

该链接提供了一个演示项目.

  1. 点击主控制器中的添加按钮,添加几个时间戳.
  2. 在主视图控制器的行之间切换,您将看到上述错误.

代码如下所示,可以从短下载的时间.

import UIKit

class DetailViewController: UIViewController,UITableViewDataSource,UITableViewDelegate,UISearchResultsUpdating,UISearchBarDelegate {

    @IBOutlet weak var basicTable: UITableView!        
    var tblSearchController:UISearchController!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.    
        self.tblSearchController = UISearchController(searchResultsController: nil)
        self.basicTable.tableHeaderView=self.tblSearchController.searchBar
//      self.tblSearchController.edgesForExtendedLayout = (UIRectEdge.Top )
//      self.tblSearchController.extendedLayoutIncludesOpaqueBars = true
        self.tblSearchController.searchResultsUpdater = self
        self.tblSearchController.searchBar.delegate = self
        self.tblSearchController.searchBar.sizeToFit()
//      self.tblSearchController.searchBar.frame=CGRectMake(0, 0, self.basicTable.frame.size.width, 44.0)
        self.tblSearchController.hidesNavigationBarDuringPresentation=true
        self.tblSearchController.dimsBackgroundDuringPresentation=true
        self.definesPresentationContext=true
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of …
Run Code Online (Sandbox Code Playgroud)

ios swift uisearchcontroller

11
推荐指数
2
解决办法
5504
查看次数

为什么:"尝试加载..同时解除分配......:UISearchController:"

我有根故事板,有一个按钮,推动ViewControllerB.

ViewControllerB有一个排序控制器UISortController.

ViewControllerB有一个"后退"方法,由根导航控制器控制.

我收到以下警告:

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7ff10258ba60>)

我使用Apple的示例(需要会员资格)来添加新的UISearchController.

有人遇到过这个吗?我该如何解决?

uitableview uisearchbar ios

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

完成用户在屏幕外点击UISearchBar的动画

轻触a时UISearchBar,取消按钮滑入,TextField位于上方以容纳按钮.我将这称为取消按钮动画.

在我的应用程序中,当用户点击搜索按钮时,带有a UISearchControllerUITableView淡入的视图.我希望​​视图淡入,取消按钮动画已经完成.与iOS音乐应用类似.我试过这个:

self.myTableView.frame = CGRectMake(0, 20, self.view.bounds.width, self.view.bounds.height - 20)
self.resultSearchController.searchBar.becomeFirstResponder()

UIView.animateWithDuration(0.3, delay: 0.0, options: .CurveLinear, animations: {
    self.myTableView.alpha = CGFloat(1.0)

        }, completion: nil)
Run Code Online (Sandbox Code Playgroud)

当我将searchBar第一响应者关闭屏幕时,不应该完成取消按钮动画完成吗?它没有.

现在,取消按钮动画在屏幕上发生,然后视图(TableView)淡入.如何在视图的alpha为0时进行取消按钮动画?

animation uitableview ios swift uisearchcontroller

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