Domanda

I have something like problem. When I activate UITextField to write something, I have addTarget to show popover below UITextField. When I keep typing popover shows suggestions.

There is bit of my code:

  [googleView.search addTarget:self action:@selector(showPopover) 
forControlEvents:UIControlEventEditingDidBegin];

    -(void)showPopover{
        suggestionTable *table = [[suggestionTable alloc]init];
        self.suggestionpopover1 =[[PCPopoverController alloc] initWithContentViewController:table];
        self.suggestionpopover1.popoverContentSize = CGSizeMake(300, 400);
        self.suggestionpopover1.delegate = self;

        [self.suggestionpopover1 presentPopoverFromRect:googleView.search.frame inView:googleView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }

My problem is, that when popover is visible my UITextField and everything else isn't active. How can keep active UITextField while I typing, and everything else should dismiss popover?

I found simillar thing in youtube app's search box.

È stato utile?

Soluzione

You need to add the text field to the popover's passthrough views.

self.suggestionpopover1.passthroughViews = @[googleView.search];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top