在使用UISearchController时,发现这是一个要求在iOS版本8以上才可以使用的,而在8之前需要要UISearchBarDelegate 和UISearchDisplayDelegate实现。这就要求我们在敲代码实例化UISearchController前,判断一下iOS系统版本是否大于8,其实一句话就可以搞定!
if ( UIDevice currentDevice].systemVersion.floatValue > 8.0f )
是不是很简单!
至于UISearchBarDelegate 和UISearchDisplayDelegated 的实现,可以参考http://www.jianshu.com/p/11b141e2605b
网友评论