Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't hide after delay #5

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

can't hide after delay #5

fjun99 opened this issue Feb 28, 2012 · 3 comments

Comments

@fjun99
Copy link

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
Copy link
Author

fjun99 commented Feb 28, 2012

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

@eliperkins
Copy link
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
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants