Comments (10)
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.
Has anyone got a solution for this?
from mbprogresshud.
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.
@adamjernst I managed it by setting the yOffset on the HUD to -77px for a standard view with keyboard at the bottom.
from mbprogresshud.
Ha, much simpler (and better).
from mbprogresshud.
The best solution would be to have MBProgressHUD listen for keyboard events and adjust it's position accordingly.
from mbprogresshud.
@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.
Ah, I see. You are correct that would be difficult to animate.
from mbprogresshud.
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.
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)
- Build fails with "use of undeclared identifier '__FILE_NAME__'" with Xcode 12
- Background view still active when MBProgressHud is shown HOT 1
- "showWhileExecuting:onTarget:withObject:animated:" What method has this method changed to?
- iOS 14 切iPhone dark模式 huD 指示器背景变白色
- 加入.mm文件后mbp报错
- Can not hide loading
- FR: Add in assets tag version XCFramework in a zip file
- SPM- Package resolution failed
- 关于扩展属性
- MBProgressHUD source change? HOT 2
- pod "MBProgressHUD":失败
- swift package collection
- xcode13 Multiple methods named 'orientation' found with mismatched result, parameter type or attributes
- 沪电\
- hud在Debug View Hierarchy上显示和我页面显示的效果不同 HOT 4
- Getting Fatal Error for Swift Package while running Unit Tests in Azure Pipe line
- Invalid Code Signing. The executable 'Payload/myapp.app/Frameworks/PKHUD.framework' must e signed with the certificate... HOT 3
- Am looking forward to
- 'MBProgressHUD.h' file not found HOT 2
- For Xcode 14.3, The minimum deployment target is expected to be at least 9.0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbprogresshud.