While Tapping on UISearchBar control then it automatically calling shouldEndEditing Delegate of UISeachBar Controller

65 Views Asked by At

While Calling the UISearchBar Begin Editing then after the popover controller present then popover gets Disappear with hiding keyboard. It Calls the EndEditing without any ENTER Key Pressing Below code shows the ShouldBeginEditing delegate of UISearchBar Controller

Sample Code:

-(BOOL)searchBarShouldBeginEditing:(UISearchBar*)searchBar

{

if([searchBar isEqual:_normalSearch_SearchBar])

{

        [[KeyboardHideShow getInstance] setScrollRectToThisFrame:[searchBar convertRect:searchBar.frame toView:self.scrollView]];



        if(!self->_normalSearchPopOverController)

        {

            [[KeyboardHideShow getInstance] setUp_With_ScrollView:nil];



            [self setTableViewController:[[UITableViewController alloc] initWithStyle:UITableViewStylePlain]];

            [self->_tableViewController.tableView setDelegate:self];

            [self->_tableViewController.tableView setDataSource:self];



            [self addTransparentView_For_NormalSearch_And_AdvancedSearch];

                //To add the transparent view



            [self setNormalSearchPopOverController:[[UIPopoverController alloc] initWithContentViewController:self->_tableViewController]];

            [self->_normalSearchPopOverController setDelegate:self];

            [self->_normalSearchPopOverController setPopoverContentSize:CGSizeMake(POPOVERWIDTH,350)];

            [self->_normalSearchPopOverController presentPopoverFromBarButtonItem:self->_searchBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];



        return YES;

    }

}



return NO;

} Kindly suggest where my code is wrong in the above example and feel free to ask any clarification regarding the code. Code working Fine with Xcode v8 but not working with Xcode 10 and Xcode 11.

0

There are 0 best solutions below