Skip to content

can't hide after delay #5

Description

@fjun99

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
            }

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions