문제

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.

도움이 되었습니까?

해결책

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

self.suggestionpopover1.passthroughViews = @[googleView.search];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top