can't hide after delay #5

Open
fjun99 opened this Issue Feb 28, 2012 · 3 comments

Projects

None yet

2 participants

@fjun99
fjun99 commented Feb 28, 2012

Hi,

I am using YRDropdownView. When I show YRDropdownView any where in the view, it can hide automatically (with delay parameter set). But when YRDropdownView is triggered in a delegate function, it can't hide automatically.

Edited: To clarify the problem and give some suggestions:

I call YRDropdownView in a delegate function which is triggered when the background download is finished. The class in which it is called is in the mainthread. The problem is that it is called in a KVO function:

  • (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
    change:(NSDictionary *)change context:(void *)context

This is not in the mainthread. So performSelector: is not working here.

[dropdown performSelector:@selector(hideUsingAnimation:) withObject:[NSNumber numberWithBool:animated] afterDelay:delay+ANIMATION_DURATION];

Suggestion: also add a mainthread test here:

            if ([NSThread isMainThread]) {
                    //do something here

            } else {
                  //do something here
            }
@fjun99
fjun99 commented Feb 28, 2012

perhaps it's my own problem. It can hide after delay in other delegate function.

@eliperkins
Contributor

Did you figure out your problem? If not, please post a little bit more sample code so I can better help you. I haven't attempted to hide a dropdown from a secondary thread.

@fjun99
fjun99 commented Feb 29, 2012

I have edited the issue before your response. And I suggest to add a thread test. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment