UISearchDisplayController灰色遮罩偏移

来源:互联网 发布:数控车床编程代码讲解 编辑:程序博客网 时间:2024/05/16 11:18

我的博客地址:http://blog.csdn.net/h_qiao欢迎访问

近期,在做一个城市选择的页面,用到了UISearchDisplayController,但是点击搜索框之后,灰色的页面出现了偏移,如下:


找资料查了很久,终于有解决办法了。解决办法如下:

- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{    for(UIView * v in controller.searchResultsTableView.superview.subviews){        if([v isKindOfClass:NSClassFromString(@"_UISearchDisplayControllerDimmingView")]){            //移动灰色遮罩位置            v.frame = CGRectMake(0, -20, ScreenWidth, C_VC_2ndREALHEIGHT - 44);        }    }}


0 0