开发者

Scroll VIew and MBProgressHUD

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..


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.


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


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

MBProgressHUD at center added to tableView or scrollView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜