分享

【IOS控件详解】之MBProgressHUD使用

 叹落花 2015-01-11
@implementation HudDemoViewController
- (IBAction) showWithLabel:(id)sender {
    // Should be initialized with the windows frame so the HUD disables all user input by covering the entire screen
    HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow];
    // Add HUD to screen
    [self.view.window addSubview:HUD];
    // Regisete for HUD callbacks so we can remove it from the window at the right time
    HUD.delegate = self;
    HUD.labelText = @"Loading";
    // Show the HUD while the provided method executes in a new thread
    [HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
}
- (void) myTask {
    // Do something usefull in here instead of sleeping ...
    sleep(3);
}
- (void)hudWasHidden {
    // Remove HUD from screen when the HUD was hidded
    [HUD removeFromSuperview];
    [HUD release];
}
@end

原文:http://www.cnblogs.com/GnagWang/archive/2011/09/29/2195710.html

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多