GithubHelp home page GithubHelp logo

Comments (4)

scalessec avatar scalessec commented on July 21, 2024

I'm unable to duplicate. If you go to the sample project and replace self.view with self.view.window everything still works as expected. What is the frame of your window?

In general, it's bad practice to add a view directly to the window because it throws off the whole concept of a view hierarchy. Plus those views won't receive important information that is only sent to subviews of the window's root view controller (like rotation events). If you're using a navigation controller, I'd recommend using self.navigationController.view to present the toast instead.

Send a gist if you're convinced it's a bug in the lib.

from toast.

eytanbiala avatar eytanbiala commented on July 21, 2024

Thanks for the reply. So it looks like using self.navigationController.view does present the toast in the correct position and orientation, but it gets hidden under the bottom toolbar if it is called while a view is being popped or presented. Any suggestions in this case?

from toast.

scalessec avatar scalessec commented on July 21, 2024

No prob. Is the navigation controller your root view controller (eg: is the navigation controller inside a tab bar controller)? Present the toast in root view controller's view. If the root is in fact the navigation controller, you could try this (hacky) solution:

On line 103 in showToast:duration:position: in Toast+UIView.m add this:
toast.layer.zPosition = CGFLOAT_MAX;

That would ensure that the toast is always the top view in that particular view hierarchy.

from toast.

eytanbiala avatar eytanbiala commented on July 21, 2024

Thanks, setting the zPosition does fix the issue.

This works as well, basically setting a delay before showing the toast so that it does not happen during a v.c. transition:

    dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 0.1);
    dispatch_after(delay, dispatch_get_main_queue(), ^(void){
        // do work in the UI thread here
        [self.navController.view makeToast:message duration:duration position:(id)position];
    });

from toast.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.