Git Product home page Git Product logo

Comments (10)

davidman avatar davidman commented on August 15, 2024 1

Yes, and certainly you can use this code to show any HUD over the keyboard:
(thanks to yongweihu, the comment above)

MBProgressHUD *bezelView = [[MBProgressHUD alloc] initWithFrame:CGRectMake(0, 64, 320, 416) ];
[[[UIApplication sharedApplication].windows objectAtIndex:1] addSubview:bezelView];

bezelView.labelText = @"Hello";
bezelView.dimBackground = YES;

bezelView.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"found.png"]];

// Set custom view mode
bezelView.mode = MBProgressHUDModeCustomView;

[bezelView show:YES];
[bezelView hide:YES afterDelay:0.7f];
[bezelView removeFromSuperViewOnHide];

Hope this helps everyone there,
Greetings from México, :D

from mbprogresshud.

nc avatar nc commented on August 15, 2024

Has anyone got a solution for this?

from mbprogresshud.

adamjernst avatar adamjernst commented on August 15, 2024

You'll have to create a second UIWindow, set the window's level to be above the keyboard, show the window, and add the HUD to that window.

I haven't done it with HUD specifically, but I've done it with other views and it works fine. However it's buggy in certain yet-unreleased versions of iOS, so test there (with regard to rotating the device).

from mbprogresshud.

nc avatar nc commented on August 15, 2024

@adamjernst I managed it by setting the yOffset on the HUD to -77px for a standard view with keyboard at the bottom.

from mbprogresshud.

adamjernst avatar adamjernst commented on August 15, 2024

Ha, much simpler (and better).

from mbprogresshud.

jdewind avatar jdewind commented on August 15, 2024

The best solution would be to have MBProgressHUD listen for keyboard events and adjust it's position accordingly.

from mbprogresshud.

adamjernst avatar adamjernst commented on August 15, 2024

@dewind I did that for a project of mine. The difficulty is that I wanted it animated, because if you set yOffset directly it just jumps to the new location which is ugly.

This led to a lot of problems because MBProgressHUD cannot be animated easily, since it uses drawRect instead of fixed layers. Hence I forked (see my fork) and reimplemented MBProgressHUD using proper layers, so yOffset can be animated.

from mbprogresshud.

jdewind avatar jdewind commented on August 15, 2024

Ah, I see. You are correct that would be difficult to animate.

from mbprogresshud.

yongweihu avatar yongweihu commented on August 15, 2024

The keyboard is contained in a window of type UITextEffectsWindow. You can get that window from [UIApplication sharedApplication].windows and then show the hud in it, which will make the hud shown over the keyboard.

For example, if two windows are contained in [UIApplication sharedApplication].windows when the keyboard is shown, you can use the following code to show the hud over the keyboard

[MBProgressHud showHUDAddedTo:[[UIApplication sharedApplication].windows objectAtIndex:1] animated:YES];

from mbprogresshud.

matej avatar matej commented on August 15, 2024

Yeah, that should work. It should become easier to animate all this, once the code is properly refactored to use an additional subview to the actual bezel.

from mbprogresshud.

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.