单击搜索栏后,有人知道如何过度调整暗黑色的大小吗?
当我单击“取消”时,我遇到问题,表格视图将消耗然后动画消失。
我用它来调整我的结果表视图的大小。
-(void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView {
tableView.frame =fTableView.frame;//CGRectMake(26, 100, 280, 310); //fTableView.frame;
tableView.backgroundColor = [UIColor colorWithRed:243.0/255.0 green:236.0/255.0 blue:212.0/255.0 alpha:1];
}
当单击搜索栏时,灰色覆盖层已满,而不是我定义的大小。
when clicked cancel button, the view will expend back.
我结合了几个答案来移动变暗的覆盖框。
1:重写UISearchDisplayController类
@interface MySearchController : UISearchDisplayController
2:重写setActive函数
- (void)setActive:(BOOL)visible animated:(BOOL)animated
{
[super setActive: visible animated: animated];
//move the dimming part down
for (UIView *subview in self.searchContentsController.view.subviews) {
//NSLog(@"%@", NSStringFromClass([subview class]));
if ([subview isKindOfClass:NSClassFromString(@"UISearchDisplayControllerContainerView")])
{
CGRect frame = subview.frame;
frame.origin.y += 10;
subview.frame = frame;
}
}
}
3:将 xib/storyboard 搜索显示控制器从 UISearchDisplayController 更改为
我的搜索控制器
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)