How do you dismiss a UISearchController ? (iOS 8 and follow)

前端 未结 5 565
野性不改
野性不改 2020-12-25 10:53

This must be trivial, but I can\'t find how you\'re supposed to dismiss a UISearchController programmatically?

Note that it\'s the new UISearchController (introduced

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-25 11:29

    Did you have this problem when you try to dismiss search controller after segueing to another view? I have encountered this problem too. I think you might want to use

    self.definesPresentationContext = true 
    

    in the view controller that presents the UISearchController as per this post UISearchController not dismissed when View is pushed. It works for me.

提交回复
热议问题