Skip to content

Commit

Permalink
fix(ios): fix top padding of dim-view in Ti.UI.TableView's search-bar (
Browse files Browse the repository at this point in the history
…#13345)

* fix(ios): fix dim view top padding

* chore: apply more fixes
  • Loading branch information
hansemannn authored Apr 12, 2022
1 parent 6d8f886 commit c0c2dcc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2444,7 +2444,7 @@ - (void)handleTap:(UITapGestureRecognizer *)tapGestureRecognizer
- (void)createDimmingView
{
if (dimmingView == nil) {
dimmingView = [[UIView alloc] initWithFrame:CGRectMake(0, self.safeAreaInsets.top + searchController.searchBar.frame.size.height, self.frame.size.width, self.frame.size.height - searchController.searchBar.frame.size.height)];
dimmingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - searchController.searchBar.frame.size.height)];
dimmingView.backgroundColor = [UIColor blackColor];
dimmingView.alpha = .2;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissSearchController)];
Expand Down
9 changes: 6 additions & 3 deletions iphone/Classes/TiUITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,10 @@ - (void)updateSearchControllerFrames
if (isSearchBarInNavigation) {
dimmingView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
} else {
[dimmingView setFrame:CGRectMake(0, searchController.searchBar.frame.size.height, self.frame.size.width, self.frame.size.height - searchController.searchBar.frame.size.height)];
CGFloat dimmingViewTopMargin = searchController.searchBar.frame.size.height + searchController.view.safeAreaInsets.top;
CGFloat dimmingViewHeight = self.frame.size.height - searchController.searchBar.frame.size.height;

[dimmingView setFrame:CGRectMake(0, dimmingViewTopMargin, self.frame.size.width, dimmingViewHeight)];
CGPoint convertedOrigin = [self.superview convertPoint:self.frame.origin toView:searchControllerPresenter.view];

UIView *searchSuperView = [searchController.view superview];
Expand Down Expand Up @@ -2426,7 +2429,7 @@ - (void)viewGetFocus
- (void)createDimmingView
{
if (dimmingView == nil) {
dimmingView = [[UIView alloc] initWithFrame:CGRectMake(0, searchController.searchBar.frame.size.height, self.frame.size.width, self.frame.size.height - searchController.searchBar.frame.size.height)];
dimmingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - searchController.searchBar.frame.size.height)];
dimmingView.backgroundColor = [UIColor blackColor];
dimmingView.alpha = .2;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissSearchController)];
Expand All @@ -2437,7 +2440,7 @@ - (void)createDimmingView

- (void)showDimmingView
{
dimmingView.frame = CGRectMake(0, searchController.searchBar.frame.size.height, self.frame.size.width, self.frame.size.height - searchController.searchBar.frame.size.height);
dimmingView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
if (!dimmingView.superview) {
[self addSubview:dimmingView];
[self bringSubviewToFront:dimmingView];
Expand Down

0 comments on commit c0c2dcc

Please sign in to comment.