AppDelegate.h:
@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>
+ (MBProgressHUD *)showGlobalProgressHUDWithTitle:(NSString *)title;
AppDelegate.m:
+ (MBProgressHUD *)showGlobalProgressHUDWithTitle:(NSString *)title {
UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];
[MBProgressHUD hideAllHUDsForView:window animated:YES];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:window animated:YES];
hud.labelText = title;
return hud;
}
在AppDelegate.m中的someOtherMethod中:
[self showGlobalProgressHUDWithTitle:@"Checking for Updates"]; //No visible interface for AppDelegate declares the selector 'showGlobalProgressHUDWithTitle:'
为什么呢?界面中的其他方法是可见的,但为什么不是这个?是否与Class方法有关?
答案 0 :(得分:1)
您正在从对象实例(self)调用类方法。
在方法声明和实现中将+更改为 - 并且您已经排序了。