Skip to content

Commit

Permalink
fix(ios): cleanup search controller on close (#13072)
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews committed Sep 21, 2021
1 parent d334ac9 commit 7041f6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions iphone/Classes/TiUITableView.m
Expand Up @@ -318,6 +318,15 @@ - (id)init
return self;
}

- (void)cleanup:(id)unused
{
if (searchController.isActive) {
searchController.active = NO;
}

[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(dismissSearchController) object:nil];
}

- (void)dealloc
{
if ([searchController isActive]) {
Expand Down
8 changes: 8 additions & 0 deletions iphone/Classes/TiUITableViewProxy.m
Expand Up @@ -88,6 +88,14 @@ - (void)viewDidAttach
}
}

- (void)windowWillClose
{
if ([self viewInitialized]) {
[self makeViewPerformSelector:@selector(cleanup:) withObject:nil createIfNeeded:NO waitUntilDone:YES];
}
[super windowWillClose];
}

- (void)gainFocus
{
[[self tableView] viewGetFocus];
Expand Down

0 comments on commit 7041f6f

Please sign in to comment.