加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – 调整大小UISearchDisplayController灰色黑色叠加层

发布时间:2020-12-14 19:54:11 所属栏目:百科 来源:网络整理
导读:一旦你点击搜索栏,任何人都知道如何调整暗淡的黑色大小? 我点击时有问题取消了tableview将耗费然后动画消失. 我使用它来调整我的结果tableview. -(void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(U
一旦你点击搜索栏,任何人都知道如何调整暗淡的黑色大小?

我点击时有问题取消了tableview将耗费然后动画消失.

我使用它来调整我的结果tableview.

-(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];   
}

单击搜索栏时,灰色叠加层已满,而不是我定义的大小.

单击取消按钮时,视图将重新开始.

解决方法

我结合了几个答案,以便移动暗淡的叠加帧.

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更改为MySearchController

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读