滚动视图和 MBProgressHUD

发布于 2024-11-19 22:53:24 字数 394 浏览 8 评论 0原文

我是 iPhone 开发新手。我在这里所做的是,加载一个带有滚动视图的视图,在该视图上显示图片。 我的应用程序中有一个基本的导航控制器.. 现在,在加载图片期间,如果图片未完全加载,我想添加 MBProgressHUD.. 我正在使用以下代码,但是,尽管在视图上添加了平视显示器,但无法在滚动视图前面看到它,因为我无法移动滚动视图。

HUD = [[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES] retain];
[[self.view superview] bringSubviewToFront:self.navigationController.view];

请提出任何建议...感谢您的帮助..

I am new to iphone development. What i have done here is, loading a view with a scroll view on which I m showing pictures.
I have got a basic navigation controller in the app..
Now, during the loading of picture if the picture is not fully loaded i want to add a MBProgressHUD..
I m using the following code for that but, not able to see the it infront of the scroll view although the hud is added on the view as i am unable to move the scroll View..

HUD = [[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES] retain];
[[self.view superview] bringSubviewToFront:self.navigationController.view];

Any Suggestions please... Thanks for your help..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

撩动你心 2024-11-26 22:53:25

基于 RuiAAPeres 的答案,这里有一些更完整的 Swift 代码:

let frameHeight = self.tableView.frame.size.height
let frameWidth = self.tableView.frame.size.width
let hudHolderYCoord = frameHeight / 4 + self.tableView.contentOffset.y
let hudHolder = HUDHolderView(frame: CGRectMake(0, hudHolderYCoord, frameWidth, frameHeight / 2))
hudHolder.backgroundColor = UIColor.clearColor()
self.view.addSubview(hudHolder)
let hud = MBProgressHUD.showHUDAddedTo(hudHolder, animated:true)
let label = "Just a sec.."
hud.labelText = label

Building on RuiAAPeres's answer, here's some more complete code in Swift:

let frameHeight = self.tableView.frame.size.height
let frameWidth = self.tableView.frame.size.width
let hudHolderYCoord = frameHeight / 4 + self.tableView.contentOffset.y
let hudHolder = HUDHolderView(frame: CGRectMake(0, hudHolderYCoord, frameWidth, frameHeight / 2))
hudHolder.backgroundColor = UIColor.clearColor()
self.view.addSubview(hudHolder)
let hud = MBProgressHUD.showHUDAddedTo(hudHolder, animated:true)
let label = "Just a sec.."
hud.labelText = label
趁年轻赶紧闹 2024-11-26 22:53:25

无论是滚动视图还是表格视图,您可以参考以下链接

将MBProgressHUD添加到tableView或scrollView中心

Whether its scrollview or tableview, you can refer the following link

MBProgressHUD at center added to tableView or scrollView

一袭白衣梦中忆 2024-11-26 22:53:24

假设当你这样做时:

HUD = [[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES] retain];

你得到一个 UIImageView,你可以这样做:

[scrolView.view addSubView HUD.view];
HUD.frame=CGRectMake(x,y,width,height) //So you can specify where you want your image.

Assuming when you do:

HUD = [[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES] retain];

You get an UIImageView, you can do something like:

[scrolView.view addSubView HUD.view];
HUD.frame=CGRectMake(x,y,width,height) //So you can specify where you want your image.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文