iphone – 如何在视图中显示加载动画 – IOS
发布时间:2020-12-14 18:58:28 所属栏目:百科 来源:网络整理
导读:我有一个视图,我想在其中显示加载动画.我已经看到一些应用程序,他们正在显示循环图像以显示加载,并且操作将在背景上发生,同样的事情我想在这里实现,任何内置动画都可以在 IOS中使用? TIA 解决方法 请使用MBProgressHUD. #import UIKit/UIKit.h;#import "MBP
我有一个视图,我想在其中显示加载动画.我已经看到一些应用程序,他们正在显示循环图像以显示加载,并且操作将在背景上发生,同样的事情我想在这里实现,任何内置动画都可以在
IOS中使用?
TIA 解决方法
请使用MBProgressHUD.
#import <UIKit/UIKit.h>; #import "MBProgressHUD.h" // import the .h file into project. @class MBProgressHudDemoViewController; @interface MBProgressHudDemoAppDelegate : NSObject <UIApplicationDelegate,MBProgressHUDDelegate> { UIWindow *window; MBProgressHudDemoViewController *viewController; MBProgressHUD *HUD;// create the object of Hud. } @property (nonatomic,retain) IBOutlet UIWindow *window; @property (nonatomic,retain) IBOutlet MBProgressHudDemoViewController *viewController; -(void)showProgressHUD:(NSString*)msg; -(void)hideProgressHUD; @end #import <UIKit/UIKit.h> #import "MBProgressHudDemoAppDelegate.h" @interface MBProgressHudDemoViewController : UIViewController { MBProgressHudDemoAppDelegate *delegate; } @end ViewControll.m文件 #import "MBProgressHudDemoViewController.h" #import "MBProgressHudDemoAppDelegate.h" @implementation MBProgressHudDemoViewController // Implement viewDidLoad to do additional setup after loading the view,typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; [self performSelector:@selector(nextDetail) withObject:nil afterDelay:2]; } -(void)nextDetail{ delegate = (MBProgressHudDemoAppDelegate*)[[UIApplication sharedApplication] delegate]; [delegate showProgressHUD:@"Please Wait..."]; [self performSelector:@selector(RemoveHud) withObject:nil afterDelay:2]; } -(void)RemoveHud{ [delegate hideProgressHUD]; } @end 产量 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |